summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2004-10-15 08:25:36 +0000
committerManuel Novoa III <mjn3@codepoet.org>2004-10-15 08:25:36 +0000
commit2224e6ca647bb46dbc0eeec78327357bdc89b94c (patch)
tree2a468ce14c3f292e50efc2764d84b19fbe41c385
parentf3e2baa25cf6d7ef62aa2c1cb6f684547dea77d7 (diff)
Rip out Peter's unacceptable "fix" and do the sane thing instead; build
the utils using the uClibc-targeted toolchain.
-rw-r--r--Rules.mak52
-rw-r--r--libpthread/Makefile17
-rw-r--r--utils/Makefile29
3 files changed, 21 insertions, 77 deletions
diff --git a/Rules.mak b/Rules.mak
index f41adaa62..7c55ed6bc 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -276,58 +276,6 @@ LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)
LIBGCC_DIR:=$(dir $(LIBGCC))
-#
-# common part for libs and binaries
-#
-# normally used start and end files
-N_START_FILE = $(LIBGCC_DIR)crtbegin.o
-N_END_FILE = $(LIBGCC_DIR)crtend.o
-
-# shared/pie start and end files
-S_START_FILE = $(LIBGCC_DIR)crtbeginS.o
-S_END_FILE = $(LIBGCC_DIR)crtendS.o
-
-ifeq ($(DOPIC),y)
- START_FILE = $(S_START_FILE)
- END_FILE = $(S_END_FILE)
-else
- START_FILE = $(N_START_FILE)
- END_FILE = $(N_END_FILE)
-endif
-
-START_FILES = $(TOPDIR)lib/crti.o $(START_FILE)
-END_FILES = $(END_FILE) $(TOPDIR)lib/crtn.o
-
-#
-# binaries specific part
-#
-ifeq ($(UCLIBC_CTOR_DTOR),y)
- CRT_FILE=$(TOPDIR)lib/crt1.o
-else
- CRT_FILE=$(TOPDIR)lib/crt0.o
-endif
-
-# PIE
-S_CRT_FILE=$(TOPDIR)lib/Scrt1.o
-
-# arm and ia64 do not use crtbeginT.o for static linking
-# please add condition for ia64 when it becomes supported
-ifeq ($(TARGET_arm),y)
- STATIC_BEGIN_FILE=$(LIBGCC_DIR)crtbegin.o
-else
- STATIC_BEGIN_FILE=$(LIBGCC_DIR)crtbeginT.o
-endif
-
-ifeq ($(UCLIBC_PIE_SUPPORT),y)
- BIN_START_FILES = $(S_CRT_FILE) $(TOPDIR)lib/crti.o $(S_START_FILE)
-else
- BIN_START_FILES = $(CRT_FILE) $(TOPDIR)lib/crti.o $(START_FILE)
-endif
-
-# static start and end files
-STATIC_BIN_START_FILES = $(CRT_FILE) $(TOPDIR)lib/crti.o $(STATIC_BEGIN_FILE)
-STATIC_BIN_END_FILES = $(N_END_FILE) $(TOPDIR)lib/crtn.o
-
########################################
#
# uClinux shared lib support
diff --git a/libpthread/Makefile b/libpthread/Makefile
index 2e3d5a856..b3b93970d 100644
--- a/libpthread/Makefile
+++ b/libpthread/Makefile
@@ -27,7 +27,7 @@ LIBPTHREAD_SHARED_FULLNAME=libpthread-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEV
LIBTHREAD_DB=libthread_db.a
LIBTHREAD_DB_SHARED=libthread_db.so
LIBTHREAD_DB_SHARED_FULLNAME=libthread_db-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-
+
DIRS=
ifeq ($(strip $(UCLIBC_HAS_THREADS)),y)
DIRS+=linuxthreads
@@ -38,10 +38,9 @@ ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
endif
endif
-# do we really have to unset these?
-ifneq ($(strip $(UCLIBC_CTOR_DTOR)),y)
- START_FILES =
- END_FILES =
+ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
+ SHARED_START_FILES = $(TOPDIR)lib/crti.o $(LIBGCC_DIR)crtbeginS.o
+ SHARED_END_FILES = $(LIBGCC_DIR)crtendS.o $(TOPDIR)lib/crtn.o
endif
ALL_SUBDIRS = linuxthreads linuxthreads_db
@@ -75,10 +74,10 @@ shared: all
if [ -f $(LIBPTHREAD) ] ; then \
set -e; \
$(LD) $(LDFLAGS_PTHREADS) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
- -o $(LIBPTHREAD_SHARED_FULLNAME) $(START_FILES) --whole-archive $(LIBPTHREAD) \
+ -o $(LIBPTHREAD_SHARED_FULLNAME) $(SHARED_START_FILES) --whole-archive $(LIBPTHREAD) \
--no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
-L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) \
- $(END_FILES); \
+ $(SHARED_END_FILES); \
$(INSTALL) -d $(TOPDIR)lib; \
$(RM) $(TOPDIR)lib/$(LIBPTHREAD_SHARED_FULLNAME) \
$(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION); \
@@ -91,10 +90,10 @@ shared: all
if [ -f $(LIBTHREAD_DB) ] ; then \
set -e; \
$(LD) $(LDFLAGS) -soname=$(LIBTHREAD_DB_SHARED).1 \
- -o $(LIBTHREAD_DB_SHARED_FULLNAME) $(START_FILES) --whole-archive $(LIBTHREAD_DB) \
+ -o $(LIBTHREAD_DB_SHARED_FULLNAME) --whole-archive $(LIBTHREAD_DB) \
--no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
-L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) \
- $(END_FILES); \
+ ; \
$(INSTALL) -d $(TOPDIR)lib; \
$(RM) $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED_FULLNAME) \
$(TOPDIR)lib/$(LIBTHREAD_DB_SHARED).1; \
diff --git a/utils/Makefile b/utils/Makefile
index 2b5e30635..168a2e920 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -16,8 +16,6 @@
# along with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-# Pull in the user's uClibc configuration, but do not
-# pull in Rules.mak.....
TOPDIR=../
include $(TOPDIR)Rules.mak
@@ -29,8 +27,7 @@ else
TARGET_ICONV =
endif
-# do we really need to reset XXFLAGS?
-XXFLAGS=
+# NOTE: We build the utils AFTER we have a uClibc-targeted toolchain.
ifeq ($(strip $(HAVE_SHARED)),y)
all: $(TARGETS) $(TARGET_ICONV)
@@ -42,32 +39,34 @@ headers:
@$(LN) -fs $(TOPDIR)include/elf.h
readelf: readelf.c
- $(CC) $(CFLAGS) -Wl,-s $^ -o $@ $(LDADD_LIBFLOAT) -L../lib
+ $(CC) $(CFLAGS) -Wl,-s $^ -o $@
$(STRIPTOOL) -x -R .note -R .comment $@
ldconfig: ldconfig.c readsoname.c
- $(CC) $(CFLAGS) $(XXFLAGS) -Wl,-s -static \
+ $(CC) $(CFLAGS) -Wl,-s -static \
-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
-DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
- -nostdlib -o $@ $(STATIC_BIN_START_FILES) $^ $(LDADD_LIBFLOAT) \
- -L../lib -lc $(LIBGCC) $(STATIC_BIN_END_FILES)
+ $^ -o $@
$(STRIPTOOL) -x -R .note -R .comment $@
ldd: ldd.c
- $(CC) $(CFLAGS) $(XXFLAGS) $(PIEFLAG) $(LDPIEFLAG) -Wl,-s \
+ $(CC) $(CFLAGS) $(PIEFLAG) $(LDPIEFLAG) -Wl,-s \
-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
-DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
- -nostdlib -o $@ $(BIN_START_FILES) $^ $(LDADD_LIBFLOAT) \
- -L../lib -lc $(LIBGCC) $(END_FILES)
+ $^ -o $@
$(STRIPTOOL) -x -R .note -R .comment $@
iconv: ../libc/misc/wchar/wchar.c
- $(CC) $(CFLAGS) $(XXFLAGS) $(PIEFLAG) $(LDPIEFLAG) -Wl,-s -DL_iconv_main \
- -nostdlib -o $@ $(BIN_START_FILES) $^ $(LDADD_LIBFLOAT) \
- -L../lib -lc $(LIBGCC) $(END_FILES)
+ $(CC) $(CFLAGS) $(PIEFLAG) $(LDPIEFLAG) -Wl,-s \
+ -DL_iconv_main \
+ $^ -o $@
$(STRIPTOOL) -x -R .note -R .comment $@
+ifeq ($(strip $(HAVE_SHARED)),y)
hostutils: ldd.host ldconfig.host readelf.host
+else
+hostutils: readelf.host
+endif
ldd.host: ldd.c
$(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
@@ -96,8 +95,6 @@ ifeq ($(strip $(HAVE_SHARED)),y)
$(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)usr/bin
$(INSTALL) -m 755 ldd $(PREFIX)$(RUNTIME_PREFIX)usr/bin/ldd
$(INSTALL) -m 755 ldconfig $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig;
- # For now, don't bother with readelf since surely the host
- # system has binutils, or we couldn't have gotten this far...
#$(INSTALL) -m 755 readelf $(PREFIX)$(RUNTIME_PREFIX)usr/bin/readelf
endif
ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)