From b2eb218fc338067d292f7e26fd4a176f27fa036b Mon Sep 17 00:00:00 2001 From: David McCullough Date: Mon, 17 Feb 2003 13:03:21 +0000 Subject: updates to the uClinux-dist romfs and uClinux shared library targets. --- Makefile | 36 +++++++++++++++++++++++++++++++++--- Rules.mak | 15 +++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 70efce967..0a513d271 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,8 @@ all: headers subdirs shared utils finished # In this section, we need .config -include .config.cmd -shared: +.PHONY: $(SHARED_TARGET) +shared: $(SHARED_TARGET) ifeq ($(strip $(HAVE_SHARED)),y) @$(MAKE) -C libc shared @$(MAKE) -C ldso shared @@ -52,10 +53,31 @@ ifeq ($(strip $(HAVE_SHARED)),y) @$(MAKE) -C libm shared @$(MAKE) -C libpthread shared else +ifeq ($(SHARED_TARGET),) @echo @echo Not building shared libraries... @echo endif +endif + +ifneq ($(SHARED_TARGET),) + +lib/main.o: $(ROOTDIR)/lib/libc/main.c + $(CC) $(CFLAGS) $(ARCH_CFLAGS) -c -o $@ $(ROOTDIR)/lib/libc/main.c + +bogus $(SHARED_TARGET): lib/libc.a lib/main.o + make -C $(ROOTDIR) relink + $(CC) -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 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 finished: shared @echo @@ -65,16 +87,24 @@ finished: shared # # Target for uClinux distro # +.PHONY: romfs romfs: + @if [ "$(CONFIG_BINFMT_SHARED_FLAT)" = "y" ]; then \ + [ -e $(ROMFSDIR)/lib ] || mkdir -p $(ROMFSDIR)/lib; \ + $(ROMFSINST) $(SHARED_TARGET) /lib/lib$(LIBID).so; \ + fi ifeq ($(strip $(HAVE_SHARED)),y) install -d $(ROMFSDIR)/lib install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \ $(ROMFSDIR)/lib - cp -a lib/*.so.* $(ROMFSDIR)/lib + cp -fa lib/*.so.* $(ROMFSDIR)/lib/. @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \ set -x -e; \ install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \ $(ROMFSDIR)/lib; \ + $(ROMFSINST) -s \ + /lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \ + /lib/ld-linux.so.2; \ fi; endif @@ -148,7 +178,7 @@ headers: include/bits/uClibc_config.h @cd $(TOPDIR); \ set -x -e; \ rm -f include/bits/sysnum.h; \ - TOPDIR=. CC=$(CC) /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h + TOPDIR=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers subdirs: $(patsubst %, _dir_%, $(DIRS)) diff --git a/Rules.mak b/Rules.mak index ec4978de9..4b9773d57 100644 --- a/Rules.mak +++ b/Rules.mak @@ -34,7 +34,9 @@ # make CROSS=mipsel-linux- # will build uClibc for 'mipsel'. +ifndef CROSS CROSS= +endif CC= $(CROSS)gcc AR= $(CROSS)ar LD= $(CROSS)ld @@ -224,3 +226,16 @@ LIBGCC_DIR:=$(dir $(LIBGCC)) # Very few people will need to change this value from the default... TARGET_PREFIX = / +######################################## +# +# uClinux shared lib support +# + +ifdef CONFIG_BINFMT_SHARED_FLAT + # For the shared version of this, we specify no stack and its library ID + FLTFLAGS += -s 0 + LIBID=1 + export LIBID FLTFLAGS + SHARED_TARGET = lib/libc +endif + -- cgit v1.2.3