[uClinux-dev] about uclinux shared library

chen allison allison_chen at hotmail.com
Thu Mar 27 16:03:20 EST 2003


Hi, all,

Thank you all hard working on shared library, right now, I'm successfully 
make my helloworld application base on shared library romfs/lib1.so, it's 
on uclibc. but when I used my own shared library romfs/lib2.so to compile 
my application, it always said: can't find entry symbol lib_main, default 
to 02000000. 

the following is my /uClibc/Makefile and helloword Makefile. if I didn't 
use lib2.so, helloworld can work properly.
 
I'll appreciate your any advice!


allison


a part of /uClibc/Makefile:


ifneq ($(SHARED_TARGET),)

lib/main.o: $(ROOTDIR)/lib/libc/main.c
	$(CC) $(CFLAGS) $(ARCH_CFLAGS) -c -o $@ $(ROOTDIR)/lib/libc/main.c

$(SHARED_TARGET): lib/libc.a lib/main.o Makefile
	make -C $(ROOTDIR) relink
	$(CC) -nostartfiles -o $(SHARED_TARGET) $(ARCH_CFLAGS) -Wl,-elf2flt 
-nostdlib		\
		-Wl,-shared-lib-id,${LIBID}				\
		lib/main.o \
		-Wl,--whole-archive,lib/libc.a,-lgcc,--no-whole-archive
	$(OBJCOPY) -L _GLOBAL_OFFSET_TABLE_ -L main -L __main -L _start \
		-L __uClibc_main -L __uClibc_start_main -L lib_main \
		-L _exit_dummy_ref		\
		-L __do_global_dtors -L __do_global_ctors		\
		-L __CTOR_LIST__ -L __DTOR_LIST__			\
		-L _current_shared_library_a5_offset_			\
		$(SHARED_TARGET).gdb
	ln -sf $(SHARED_TARGET).gdb .
endif



ifneq ($(SHARED_TARGET1),)

lib/main.o: $(ROOTDIR)/lib/libc/main.c
	$(CC) $(CFLAGS) $(ARCH_CFLAGS) -c -o $@ $(ROOTDIR)/lib/libc/main.c


$(SHARED_TARGET1): lib/libm.a lib/main.o Makefile
	make -C $(ROOTDIR) relink
	$(CC) -nostartfiles -o $(SHARED_TARGET1) $(ARCH_CFLAGS) -Wl,-elf2flt 
-nostdlib		\
		-Wl,-shared-lib-id,${LIBID1}				\
		lib/main.o \
		-Wl,--whole-archive,lib/libm.a --no-whole-archive -L$(TOPDIR)/lib -lgcc 
-lc
	$(OBJCOPY) -L _GLOBAL_OFFSET_TABLE_ -L main -L __main -L _start \
		-L __uClibc_main -L __uClibc_start_main -L lib_main \
		-L _exit_dummy_ref		\
		-L __do_global_dtors -L __do_global_ctors		\
		-L __CTOR_LIST__ -L __DTOR_LIST__			\
		-L _current_shared_library_a5_offset_			\
		$(SHARED_TARGET1).gdb
	ln -sf $(SHARED_TARGET1).gdb .
endif




helloword Makefile:
#!/bin/bash

m68k-elf-gcc -m5307 -DCONFIG_COLDFIRE -Os -g -fomit-frame-pointer -m5307 \
-DCONFIG_COLDFIRE -DCONFIG_SECUREEDGE -Dlinux -D__linux__ -Dunix 
-D__uClinux__ \
-DEMBED -I/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/uClibc/include 
\
-I/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libm 
-I/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libcrypt_old \
-I/usrnew/alisonc/projects/uClinux/uClinux-dist -fno-builtin 
-mid-shared-library -mshared-library-id=0 \
-mid-shared-library -mshared-library-id=2 
-I/usrnew/alisonc/projects/uClinux/uClinux-dist/linux-2.4.x/include -Wall 
-Wshadow -Os \
-fomit-frame-pointer -D_GNU_SOURCE  -DBB_VER='"0.60.4"' 
-DBB_BT='"2003.03.27-14:34+0000"' \
-DCONFIG_H='"config.h"' -DUSE_SYSTEM_PWD_GRP  -Wall -Wshadow -Os 
-fomit-frame-pointer \
-D_GNU_SOURCE  -DBB_VER='"0.60.4"' -DBB_BT='"2003.03.27-14:34+0000"' 
-DCONFIG_H='"config.h"' \
-DUSE_SYSTEM_PWD_GRP  -I.   -c hello.c -o hello.o


m68k-elf-gcc -m5307 -DCONFIG_COLDFIRE -Os -g -fomit-frame-pointer -m5307 
-DCONFIG_COLDFIRE \
-DCONFIG_SECUREEDGE -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED \
-I/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/uClibc/include \
-I/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libm \
-I/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libcrypt_old \
-I/usrnew/alisonc/projects/uClinux/uClinux-dist -fno-builtin 
-mid-shared-library \
-mshared-library-id=0 -mid-shared-library -mshared-library-id=2 
-I/usrnew/alisonc/projects/uClinux/uClinux-dist/linux-2.4.x/include \
-Wl,-elf2flt -Wl,-move-rodata -Wl,-shared-lib-id,0 -Wl,-shared-lib-id,2 
-nostartfiles \
/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/uClibc/lib/crt0.o \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/uClibc/. \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/uClibc/lib \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libm \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libnet \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libdes \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libaes \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libpcap \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libssl \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libcrypt_old \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libsnapgear++ \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/libsnapgear \
-L/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/zlib -s 
-Wl,-warn-common -s \
-Wl,-warn-common -o hello hello.o \
-Wl,-R,/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/uClibc/libc.gdb \
-lc -lm 
-Wl,-R,/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/uClibc/libc.gdb \
-Wl,-R,/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/uClibc/libm.gdb \
-lc -lm 
-Wl,-R,/usrnew/alisonc/projects/uClinux/uClinux-dist/lib/uClibc/libm.gdb 
-lc










_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn  




More information about the uClinux-dev mailing list