a single .c file, making stuff be even smaller.
ld-uclibc.so*
-ld-uClibc.h
+ldso.h
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 *~
/* 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;
/* 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,
/* 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,
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)
* 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
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;
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:
return;
}
+#include "hash.c"
+#include "readelflib1.c"
/* 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;