From a5e190ebf33284ffe4684be1cb8a1019163d7bc8 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 23 Jan 2002 16:04:40 +0000 Subject: Fixup build a bit. Be sneaky and include everything into a single .c file, making stuff be even smaller. --- ldso/ldso/.cvsignore | 2 +- ldso/ldso/Makefile | 20 +++++++++++++++----- ldso/ldso/dl-elf.c | 11 ----------- ldso/ldso/dl-hash.c | 6 ------ ldso/ldso/hash.c | 6 ------ ldso/ldso/i386/elfinterp.c | 7 ------- ldso/ldso/ldso.c | 8 +++++--- ldso/ldso/readelflib1.c | 11 ----------- 8 files changed, 21 insertions(+), 50 deletions(-) diff --git a/ldso/ldso/.cvsignore b/ldso/ldso/.cvsignore index 962b65384..ed93c7d9c 100644 --- a/ldso/ldso/.cvsignore +++ b/ldso/ldso/.cvsignore @@ -1,2 +1,2 @@ ld-uclibc.so* -ld-uClibc.h +ldso.h diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile index 8a320c4e1..37e114b8f 100644 --- a/ldso/ldso/Makefile +++ b/ldso/ldso/Makefile @@ -29,34 +29,44 @@ include $(TOPDIR)Rules.mak LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so -CFLAGS += -fPIC -D__PIC__ #XXFLAGS += #-DDL_DEBUG #-funroll-loops XXFLAGS+=-DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \ -DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \ -DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR) && pwd)\" -CSRC= ldso.c hash.c readelflib1.c $(TARGET_ARCH)/elfinterp.c +LDFLAGS=-nostdlib -shared --warn-common --export-dynamic --warn-once \ + -z combreloc --sort-common --discard-locals --discard-all +CSRC= ldso.c #hash.c readelflib1.c $(TARGET_ARCH)/elfinterp.c COBJS=$(patsubst %.c,%.o, $(CSRC)) ASRC=$(shell ls $(TARGET_ARCH)/*.S) AOBJS=$(patsubst %.S,%.o, $(ASRC)) OBJS=$(AOBJS) $(COBJS) +ifneq ($(strip $(DODEBUG)),true) +LDFLAGS+=-s +endif all: lib lib:: ldso.h $(OBJS) $(DLINK_OBJS) - $(LD) -e _dl_boot $(LDFLAGS) -nostdlib -shared -o $(LDSO_FULLNAME) \ - -soname=$(UCLIBC_LDSO) -Bstatic $(OBJS) + $(CC) -e _dl_boot $(LDFLAGS) -o $(LDSO_FULLNAME) \ + -Wl,-soname=$(UCLIBC_LDSO) $(OBJS) install -d $(TOPDIR)lib install -m 755 $(LDSO_FULLNAME) $(TOPDIR)lib (cd $(TOPDIR)lib && ln -sf $(LDSO_FULLNAME) $(UCLIBC_LDSO)) ldso.h: Makefile - echo "#define _dl_static_progname \""$(UCLIBC_LDSO)"\"" > ld-uClibc.h + echo "const char *_dl_progname=\""$(UCLIBC_LDSO)"\";" > ldso.h + echo "#include \"$(TARGET_ARCH)/elfinterp.c\"" >> ldso.h + $(COBJS): %.o : %.c $(CC) $(CFLAGS) $(XXFLAGS) -I. -I./$(TARGET_ARCH) -I../libdl -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o +$(AOBJS): %.o : %.S + $(CC) $(CFLAGS) -I. -I./$(TARGET_ARCH) -I../libdl -c $< -o $@ + $(STRIPTOOL) -x -R .note -R .comment $*.o + clean:: $(RM) -f $(UCLIBC_LDSO)* $(OBJS) $(LDSO_FULLNAME)* core *.o *.a *.s *.i ldso.h *~ diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 335f6fc29..d12f9e1f0 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -21,17 +21,6 @@ /* This file contains the helper routines to load an ELF sharable library into memory and add the symbol table info to the chain. */ -#include "linuxelf.h" -#include "ld_hash.h" -#include "ld_syscall.h" -#include "ld_string.h" -#include -#ifdef USE_CACHE -#include "../config.h" -#endif - -extern char *_dl_progname; - #ifdef USE_CACHE static caddr_t _dl_cache_addr = NULL; diff --git a/ldso/ldso/dl-hash.c b/ldso/ldso/dl-hash.c index 40d29bb44..15dfc3ab6 100644 --- a/ldso/ldso/dl-hash.c +++ b/ldso/ldso/dl-hash.c @@ -20,12 +20,6 @@ /* Various symbol table handling functions, including symbol lookup */ -#include "dlfcn.h" -#include "linuxelf.h" -#include "ld_hash.h" -#include "ld_syscall.h" -#include "ld_string.h" - /* * This is the start of the linked list that describes all of the files present * in the system with pointers to all of the symbol, string, and hash tables, diff --git a/ldso/ldso/hash.c b/ldso/ldso/hash.c index 40d29bb44..15dfc3ab6 100644 --- a/ldso/ldso/hash.c +++ b/ldso/ldso/hash.c @@ -20,12 +20,6 @@ /* Various symbol table handling functions, including symbol lookup */ -#include "dlfcn.h" -#include "linuxelf.h" -#include "ld_hash.h" -#include "ld_syscall.h" -#include "ld_string.h" - /* * This is the start of the linked list that describes all of the files present * in the system with pointers to all of the symbol, string, and hash tables, diff --git a/ldso/ldso/i386/elfinterp.c b/ldso/ldso/i386/elfinterp.c index 7745b1405..3b8b58af4 100644 --- a/ldso/ldso/i386/elfinterp.c +++ b/ldso/ldso/i386/elfinterp.c @@ -39,13 +39,6 @@ static char *_dl_reltypes[] = a more than adequate job of explaining everything required to get this working. */ -#include "linuxelf.h" -#include "ld_hash.h" -#include "ld_syscall.h" -#include "ld_string.h" - -extern char *_dl_progname; - extern int _dl_linux_resolve(void); unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 6d8b881e7..61db05d6f 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -91,11 +91,12 @@ * can transfer control to the user's application. */ -#include "linuxelf.h" #include +#include "linuxelf.h" #include "ld_hash.h" #include "ld_syscall.h" #include "ld_string.h" +#include "dlfcn.h" #include "../config.h" #define ALLOW_ZERO_PLTGOT @@ -115,8 +116,6 @@ static char *_dl_malloc_addr, *_dl_mmap_zero; char *_dl_library_path = 0; /* Where we look for libraries */ char *_dl_preload = 0; /* Things to be loaded before the libs. */ -#include "ld-uClibc.h" /* Pull in the name of ld.so */ -const char *_dl_progname=_dl_static_progname; static char *_dl_not_lazy = 0; #ifdef DL_TRACE static char *_dl_trace_loaded_objects = 0; @@ -134,6 +133,7 @@ void _dl_debug_state(void); char *_dl_get_last_path_component(char *path); #include "boot1_arch.h" +#include "ldso.h" /* Pull in the name of ld.so */ /* When we enter this piece of code, the program stack looks like this: @@ -1210,3 +1210,5 @@ void _dl_dprintf(int fd, const char *fmt, ...) return; } +#include "hash.c" +#include "readelflib1.c" diff --git a/ldso/ldso/readelflib1.c b/ldso/ldso/readelflib1.c index 335f6fc29..d12f9e1f0 100644 --- a/ldso/ldso/readelflib1.c +++ b/ldso/ldso/readelflib1.c @@ -21,17 +21,6 @@ /* This file contains the helper routines to load an ELF sharable library into memory and add the symbol table info to the chain. */ -#include "linuxelf.h" -#include "ld_hash.h" -#include "ld_syscall.h" -#include "ld_string.h" -#include -#ifdef USE_CACHE -#include "../config.h" -#endif - -extern char *_dl_progname; - #ifdef USE_CACHE static caddr_t _dl_cache_addr = NULL; -- cgit v1.2.3