[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[microblaze-uclinux] Reloc outside program - Problem
Hi everyone,
I'm having trouble running a program. When I start it, it says BINFMT_FLAT: reloc outside program .... killing bctest!....
I've read the thread under http://marc.10east.com/?t=113779973400001&r=1&w=2 ,
and if I understood it right, the problem is using static variables that are already used (I used the variable "port"). However i substituted this variable, but I'm still experiencing the same problem.
My code:
/* server.c */
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
int main (void) {
int socket_descriptor;
struct sockaddr_in address;
socket_descriptor = socket (AF_INET, SOCK_DGRAM, 0);
if (socket_descriptor == -1) {
perror ("socket()");
exit (EXIT_FAILURE);
}
memset (&address, 0, sizeof (address));
address.sin_family = AF_INET;
address.sin_addr.s_addr = inet_addr ("224.0.0.1");
address.sin_port = htons (1234);
printf ("Server ist bereit ...\n");
/* Broadcasting beginnen */
while (1) {
if (sendto( socket_descriptor,
"broadcast test (hallo client)",
sizeof ("broadcast test (hallo client)"),
0,
(struct sockaddr *) &address,
sizeof (address)) < 0) {
perror ("sendto()");
exit (EXIT_FAILURE);
}
sleep (1);
}
return EXIT_SUCCESS;
}
My Makefile
ifndef ROOTDIR
ROOTDIR=../uClinux-dist
endif
UCLINUX_BUILD_USER = 1
include $(ROOTDIR)/.config
LINUXDIR = linux-2.4.x
LINUX_CONFIG = $(ROOTDIR)/$(LINUXDIR)/.config
include $(LINUX_CONFIG)
LIBCDIR = $(CONFIG_LIBCDIR)
include $(ROOTDIR)/config.arch
PATH:=$(PATH):$(ROOTDIR)/tools
WSNMS = bctest
WSNMS_OBJS = bctest.o
all: $(WSNMS)
$(WSNMS): $(WSNMS_OBJS)
$(CC) $(LDFLAGS) -o $@ $(WSNMS_OBJS) $(LIBPTHREAD) $(LDLIBS)
clean:
-rm -f $(WSNMS) *.elf *.gdb *.o
%.o: %.c
$(CC) -c $(CFLAGS) -fno-common -o $@ $<
Best regards
Jan Schulte
______________________________________________________________________________
"Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/