summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-01-23 16:04:40 +0000
committerEric Andersen <andersen@codepoet.org>2002-01-23 16:04:40 +0000
commita5e190ebf33284ffe4684be1cb8a1019163d7bc8 (patch)
tree6771b4ba50e6d34877068e4c7abfe80d52fea4d0 /ldso
parent85c0183cb45fbaee7fa0a8d8c9cb0a0a2a642d00 (diff)
Fixup build a bit. Be sneaky and include everything into
a single .c file, making stuff be even smaller.
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/.cvsignore2
-rw-r--r--ldso/ldso/Makefile20
-rw-r--r--ldso/ldso/dl-elf.c11
-rw-r--r--ldso/ldso/dl-hash.c6
-rw-r--r--ldso/ldso/hash.c6
-rw-r--r--ldso/ldso/i386/elfinterp.c7
-rw-r--r--ldso/ldso/ldso.c8
-rw-r--r--ldso/ldso/readelflib1.c11
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 <sys/mman.h>
-#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 <stdarg.h>
+#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 <sys/mman.h>
-#ifdef USE_CACHE
-#include "../config.h"
-#endif
-
-extern char *_dl_progname;
-
#ifdef USE_CACHE
static caddr_t _dl_cache_addr = NULL;