Browse Source

Add the current implementation to review

Peter S. Mazinger 19 years ago
parent
commit
5e48b8b628
9 changed files with 186 additions and 25 deletions
  1. 23 14
      Makefile.libs
  2. 1 1
      Makerules
  3. 59 0
      ldso/ldso/Makefile.in
  4. 11 10
      ldso/libdl/Makefile.in
  5. 23 0
      libintl/Makefile.in
  6. 16 0
      libnsl/Makefile.in
  7. 16 0
      libresolv/Makefile.in
  8. 16 0
      librt/Makefile.in
  9. 21 0
      libutil/Makefile.in

+ 23 - 14
Makefile.libs

@@ -31,6 +31,8 @@ $(LIB_NAME)_OBJ_PIC:=$(patsubst %.o,%.os,$($(LIB_NAME)_OBJ))
 
 $(LIB_NAME)_MOBJ_PIC:=$(patsubst %.o,%.os,$($(LIB_NAME)_MOBJ))
 
+$(LIB_NAME)_SOBJ_PIC:=$(patsubst %.o,%.os,$($(LIB_NAME)_SOBJ))
+
 #libso-y+=$(top_builddir)lib/$(LIB_NAME).so
 #liba-y+=$(top_builddir)lib/$(LIB_NAME).a
 #libclean-y+=$(LIB_NAME)_clean
@@ -47,49 +49,56 @@ $($(LIB_NAME)_MOBJ): $($(LIB_NAME)_MSRC)
 $($(LIB_NAME)_MOBJ_PIC): $($(LIB_NAME)_MSRC)
 	$(compile.m) $(PICFLAG)
 
+$($(LIB_NAME)_SOBJ): %.o : %.S
+	$(compile.S)
+
+$($(LIB_NAME)_SOBJ_PIC): %.os : %.S
+	$(compile.S) $(PICFLAG)
+
 # this should be changed to .os after libc/misc/internals/ is done
+libc:=$(top_builddir)lib/libc.so
 interp:=$(top_builddir)libc/misc/internals/interp.o
 ifeq ($(strip $(EXTRA_LINK_LIBS)),)
-EXTRA_LINK_LIBS=$(interp) -L$(top_builddir)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
+#EXTRA_LINK_LIBS:=$(interp) -L$(top_builddir)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
+EXTRA_LINK_LIBS:=$(interp) $(libc) $(LDADD_LIBFLOAT) $(LIBGCC)
 endif
 
-$(top_builddir)lib/$(LIB_NAME).so: $($(LIB_NAME)_DIR)/$(LIB_NAME)_pic.a $(interp)
+$(top_builddir)lib/$(LIB_NAME).so: $($(LIB_NAME)_DIR)/$(LIB_NAME)_pic.a $(interp) $(libc)
 	$(INSTALL) -d $(top_builddir)lib
 	$(RM) $@ $@.$(MAJOR_VERSION) $(top_builddir)lib/$($(LIB_NAME)_FULL_NAME)
-	$(LD) $(LDFLAGS) -soname=$(notdir $@).$(MAJOR_VERSION) -o $(top_builddir)lib/$($(LIB_NAME)_FULL_NAME) \
-		$(EXTRA_LINK_OPTS) $(SHARED_START_FILES) --whole-archive $(firstword $^) \
-		--no-whole-archive $(EXTRA_LINK_LIBS) $(SHARED_END_FILES)
+	$(LD) $(LDFLAGS) $(EXTRA_LINK_OPTS) -soname=$(notdir $@).$(MAJOR_VERSION) \
+		-o $(top_builddir)lib/$($(LIB_NAME)_FULL_NAME) $(SHARED_START_FILES) \
+		--whole-archive $(firstword $^) --no-whole-archive \
+		$(EXTRA_LINK_LIBS) $(SHARED_END_FILES)
 	$(LN) -sf $($(LIB_NAME)_FULL_NAME) $@.$(MAJOR_VERSION)
 	$(LN) -sf $($(LIB_NAME)_FULL_NAME) $@
 
-$(top_builddir)lib/$(LIB_NAME).so1: $($(LIB_NAME)_OBJ_PIC) $($(LIB_NAME)_MOBJ_PIC)
+$(top_builddir)lib/$(LIB_NAME).so1: $($(LIB_NAME)_OBJ_PIC) $($(LIB_NAME)_MOBJ_PIC) $($(LIB_NAME)_SOBJ_PIC) $($(LIB_NAME)_SO_ADD)
 	$(INSTALL) -d $(top_builddir)lib
 	$(RM) $@ $@.$(MAJOR_VERSION) $(top_builddir)lib/$($(LIB_NAME)_FULL_NAME)
-	$(LD) $(LDFLAGS) -soname=$(notdir $@).$(MAJOR_VERSION) -o $(top_builddir)lib/$($(LIB_NAME)_FULL_NAME) \
-		$(EXTRA_LINK_OPTS) $(SHARED_START_FILES) $^ \
+	$(LD) $(LDFLAGS) $(EXTRA_LINK_OPTS) -soname=$(notdir $@).$(MAJOR_VERSION) \
+		-o $(top_builddir)lib/$($(LIB_NAME)_FULL_NAME) $(SHARED_START_FILES) $^ \
 		$(EXTRA_LINK_LIBS) $(SHARED_END_FILES)
 	$(LN) -sf $($(LIB_NAME)_FULL_NAME) $@.$(MAJOR_VERSION)
 	$(LN) -sf $($(LIB_NAME)_FULL_NAME) $@
 
-$($(LIB_NAME)_DIR)/$(LIB_NAME)_pic.a: $($(LIB_NAME)_OBJ_PIC) $($(LIB_NAME)_MOBJ_PIC)
-ifneq ($(strip $(STRIP_FLAGS)),)
-	$(STRIPTOOL) $(STRIP_FLAGS) $^
+$($(LIB_NAME)_DIR)/$(LIB_NAME)_pic.a: $($(LIB_NAME)_OBJ_PIC) $($(LIB_NAME)_MOBJ_PIC) $($(LIB_NAME)_SOBJ_PIC) $($(LIB_NAME)_SO_ADD)
+ifneq ($(strip $($(LIB_NAME)_STRIP_FLAGS)),)
+	$(STRIPTOOL) $($(LIB_NAME)_STRIP_FLAGS) $^
 else
 	$(STRIPTOOL) -x -R .note -R .comment $^
 endif
 	$(AR) $(ARFLAGS) $@ $^
-	#(AR) $(ARFLAGS) $@ $($(LIB_NAME)_OBJ_PIC) $($(LIB_NAME)_MOBJ_PIC)
 
 ifeq ($(DOPIC),y)
 $(top_builddir)lib/$(LIB_NAME).a: $($(LIB_NAME)_DIR)/$(LIB_NAME)_pic.a
 	$(RM) $@
 	cp $< $@
 else
-$(top_builddir)lib/$(LIB_NAME).a: $($(LIB_NAME)_OBJ) $($(LIB_NAME)_MOBJ)
+$(top_builddir)lib/$(LIB_NAME).a: $($(LIB_NAME)_OBJ) $($(LIB_NAME)_MOBJ) $($(LIB_NAME)_SOBJ) $($(LIB_NAME)_A_ADD)
 	$(RM) $@
 	$(STRIPTOOL) -x -R .note -R .comment $^
 	$(AR) $(ARFLAGS) $@ $^
-	#(AR) $(ARFLAGS) $@ $($(LIB_NAME)_OBJ) $($(LIB_NAME)_MOBJ)
 endif
 
 $(LIB_NAME)_clean:

+ 1 - 1
Makerules

@@ -1,7 +1,7 @@
 #
 # Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
 #
-.SUFFIXES: .c .S .o .os .so .a .s
+.SUFFIXES: .c .S .o .os .so .a .s .i
 
 ifndef top_srcdir
 top_srcdir=$(CURDIR)

+ 59 - 0
ldso/ldso/Makefile.in

@@ -0,0 +1,59 @@
+# Makefile for uClibc
+#
+# Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
+#
+
+LIB_NAME:=ld-uClibc
+
+# psm: I do not know if the order of includes is relevant
+# to be sure I have put them first
+CFLAGS:=-I$(top_srcdir)ldso/include -I. $(CFLAGS) $(PICFLAG) $(SSP_DISABLE_FLAGS)
+
+CFLAGS+=-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\"
+
+ifeq ($(SUPPORT_LD_DEBUG),y)
+CFLAGS+=-D__SUPPORT_LD_DEBUG__
+endif
+
+ifeq ($(SUPPORT_LD_DEBUG_EARLY),y)
+CFLAGS+=-D__SUPPORT_LD_DEBUG_EARLY__
+endif
+
+ifeq ($(DODEBUG),y)
+# Not really much point in including debugging info, since gdb
+# can't really debug ldso, since gdb requires help from ldso to
+# debug things....
+# psm: keep this in sync w/ Rules.mak
+CFLAGS:=$(CFLAGS:-O0 -g3=-Os -g)
+endif
+
+# BEWARE!!! At least mips* will die if -O0 is used!!!
+ifeq ($(TARGET_ARCH),mips)
+CFLAGS:=$(CFLAGS:-O0=-O1)
+endif
+
+# This stuff will not work with -fomit-frame-pointer
+CFLAGS:=$(CFLAGS:-fomit-frame-pointer=)
+
+ifeq ($(SUPPORT_LD_DEBUG),y)
+LDFLAGS:=$(LDFLAGS_NOSTRIP)
+endif
+
+srcdir=$(top_srcdir)ldso/ldso
+$(LIB_NAME)_DIR:=$(top_builddir)ldso/ldso
+
+$(LIB_NAME)_SRC:=$(srcdir)/ldso.c
+
+$(LIB_NAME)_SSRC:=$(wildcard $(srcdir)/$(TARGET_ARCH)/*.S)
+$(LIB_NAME)_SOBJ:=$(patsubst $(srcdir)/$(TARGET_ARCH)/%.S,$($(LIB_NAME)_DIR)/$(TARGET_ARCH)/%.o,$($(LIB_NAME)_SSRC))
+
+EXTRA_LINK_OPTS:=-e _start -z now -Bsymbolic --export-dynamic --sort-common --discard-locals --discard-all --no-undefined
+EXTRA_LINK_LIBS:=$(LIBGCC) # $(LDADD_LIBFLOAT)
+
+libso-$(HAVE_SHARED)+=$(top_builddir)lib/$(LIB_NAME).so
+libclean-y+=$(LIB_NAME)_clean $(LIB_NAME)_arch_clean
+
+$(LIB_NAME)_arch_clean:
+	$(RM) $($(LIB_NAME)_DIR)/*/*.{o,os}
+
+include $(top_srcdir)Makefile.libs

+ 11 - 10
ldso/libdl/Makefile.in

@@ -3,7 +3,13 @@
 # Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
 #
 
-CFLAGS+=$(SSP_ALL_CFLAGS) -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\"
+LIB_NAME:=libdl
+
+# psm: I do not know if the order of includes is relevant
+# to be sure I added them first
+CFLAGS:=-I$(top_builddir)ldso/include -I$(top_builddir)ldso/ldso $(CFLAGS) $(SSP_ALL_CFLAGS)
+
+CFLAGS+=-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\"
 
 ifeq ($(SUPPORT_LD_DEBUG),y)
 CFLAGS+=-D__SUPPORT_LD_DEBUG__
@@ -14,30 +20,28 @@ ifeq ($(TARGET_ARCH),mips)
 CFLAGS:=$(CFLAGS:-O0=-O1)
 endif
 
-CFLAGS:=-I$(top_srcdir)ldso/include -I$(top_srcdir)ldso/ldso $(CFLAGS)
-
 CFLAGS-.os=-DSHARED
 # we adapt CFLAGS, because libdl.a has an additional object
 ifeq ($(DOPIC),y)
 CFLAGS-.o=$(PICFLAG)
-resolv:=$(top_builddir)ldso/$(TARGET_ARCH)/resolv.os
+resolv:=$(top_builddir)ldso/ldso/$(TARGET_ARCH)/resolve.os
 else
-resolv:=$(top_builddir)ldso/$(TARGET_ARCH)/resolv.o
+resolv:=$(top_builddir)ldso/ldso/$(TARGET_ARCH)/resolve.o
 endif
 
 EXTRA_LINK_OPTS:=-fini dl_cleanup
-#EXTRA_LINK_LIBS:=$(interp) -L$(top_builddir)lib -lc $(LDADD_LIBFLOAT) $(top_builddir)lib/$(UCLIBC_LDSO) $(LIBGCC)
 
 # we need for all cases a "full" libdl.a the pic version used to build libdl.so misses $(resolv)
 # because it is linked against ld.so
 DOPIC=n
 
-LIB_NAME:=libdl
 srcdir=$(top_srcdir)ldso/$(LIB_NAME)
 $(LIB_NAME)_DIR:=$(top_builddir)ldso/$(LIB_NAME)
 
 $(LIB_NAME)_SRC:=$(srcdir)/libdl.c
 
+$(LIB_NAME)_A_ADD:=$(resolv)
+
 libso-$(HAVE_SHARED)+=$(top_builddir)lib/$(LIB_NAME).so
 liba-$(HAVE_SHARED)+=$(top_builddir)lib/$(LIB_NAME).a
 libclean-y+=$(LIB_NAME)_clean
@@ -46,6 +50,3 @@ include $(top_srcdir)Makefile.libs
 
 # !!! these lines have to come after including Makefile.libs !!!
 EXTRA_LINK_LIBS+=$(top_builddir)lib/$(UCLIBC_LDSO)
-
-# should only go into libdl.a, OBJ_PIC is not modified here
-$(LIB_NAME)_OBJ+=$(resolv)

+ 23 - 0
libintl/Makefile.in

@@ -0,0 +1,23 @@
+# Makefile.in for uClibc
+#
+# Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
+#
+
+CFLAGS+=$(SSP_ALL_CFLAGS)
+
+LIB_NAME:=libintl
+
+srcdir=$(top_srcdir)$(LIB_NAME)
+$(LIB_NAME)_DIR:=$(top_builddir)$(LIB_NAME)
+
+$(LIB_NAME)_MSRC:=$(srcdir)/intl.c
+MOBJ:=gettext.o ngettext.o  dgettext.o dcgettext.o dngettext.o dcngettext.o \
+	textdomain.o bindtextdomain.o bind_textdomain_codeset.o \
+	_nl_expand_alias.o _nl_msg_cat_cntr.o # glibc-isms
+$(LIB_NAME)_MOBJ:=$(patsubst %.o,$($(LIB_NAME)_DIR)/%.o,$(MOBJ))
+
+libso-$(UCLIBC_HAS_GETTEXT_AWARENESS)+=$(top_builddir)lib/$(LIB_NAME).so
+liba-$(UCLIBC_HAS_GETTEXT_AWARENESS)+=$(top_builddir)lib/$(LIB_NAME).a
+libclean-y+=$(LIB_NAME)_clean
+
+include $(top_srcdir)Makefile.libs

+ 16 - 0
libnsl/Makefile.in

@@ -0,0 +1,16 @@
+# Makefile.in for uClibc
+#
+# Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
+#
+
+CFLAGS+=$(SSP_ALL_CFLAGS)
+
+LIB_NAME:=libnsl
+
+srcdir=$(top_srcdir)$(LIB_NAME)
+
+libso-y+=$(top_builddir)lib/$(LIB_NAME).so
+liba-y+=$(top_builddir)lib/$(LIB_NAME).a
+libclean-y+=$(LIB_NAME)_clean
+
+include $(top_srcdir)Makefile.libs

+ 16 - 0
libresolv/Makefile.in

@@ -0,0 +1,16 @@
+# Makefile.in for uClibc
+#
+# Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
+#
+
+CFLAGS+=$(SSP_ALL_CFLAGS)
+
+LIB_NAME:=libresolv
+
+srcdir=$(top_srcdir)$(LIB_NAME)
+
+libso-y+=$(top_builddir)lib/$(LIB_NAME).so
+liba-y+=$(top_builddir)lib/$(LIB_NAME).a
+libclean-y+=$(LIB_NAME)_clean
+
+include $(top_srcdir)Makefile.libs

+ 16 - 0
librt/Makefile.in

@@ -0,0 +1,16 @@
+# Makefile.in for uClibc
+#
+# Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
+#
+
+CFLAGS+=$(SSP_ALL_CFLAGS)
+
+LIB_NAME:=librt
+
+srcdir=$(top_srcdir)$(LIB_NAME)
+
+libso-y+=$(top_builddir)lib/$(LIB_NAME).so
+liba-y+=$(top_builddir)lib/$(LIB_NAME).a
+libclean-y+=$(LIB_NAME)_clean
+
+include $(top_srcdir)Makefile.libs

+ 21 - 0
libutil/Makefile.in

@@ -0,0 +1,21 @@
+# Makefile.in for uClibc
+#
+# Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
+#
+
+CFLAGS+=$(SSP_ALL_CFLAGS)
+
+LIB_NAME:=libutil
+
+srcdir=$(top_srcdir)$(LIB_NAME)
+
+$(LIB_NAME)_SRC:=$(wildcard $(srcdir)/*.c)
+ifneq ($(ARCH_HAS_MMU),y)
+$(LIB_NAME)_SRC:=$(filter-out $(srcdir)/forkpty.c,$($(LIB_NAME)_SRC))
+endif
+
+libso-y+=$(top_builddir)lib/$(LIB_NAME).so
+liba-y+=$(top_builddir)lib/$(LIB_NAME).a
+libclean-y+=$(LIB_NAME)_clean
+
+include $(top_srcdir)Makefile.libs