Browse Source

This syncs things up with my local tree. Mainly changes installer
issues, and syns things (as far as I am willing) with Dave Schleef's
tree. We may need to go another round or so, but we do seem to be
converging...

Eric Andersen 24 years ago
parent
commit
c3bbc0eafd

+ 34 - 28
Makefile

@@ -43,9 +43,9 @@ Config:
 
 
 shared:
 shared:
 	@$(MAKE) -C libc shared
 	@$(MAKE) -C libc shared
-	@$(MAKE) -C ldso/util
+	@$(MAKE) -C $(LIBRARY_CACHE) ldso/util
 ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
 ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
-	@$(MAKE) -C ldso shared
+	@$(MAKE) -C $(LIBRARY_CACHE) ldso shared
 endif
 endif
 	@$(MAKE) -C libcrypt shared
 	@$(MAKE) -C libcrypt shared
 	@$(MAKE) -C libutil shared
 	@$(MAKE) -C libutil shared
@@ -178,16 +178,19 @@ install: install_dev install_runtime install_gcc
 # directory.
 # directory.
 install_target:
 install_target:
 ifeq ($(DO_SHARED),shared)
 ifeq ($(DO_SHARED),shared)
-	install -d $(TARGET_PREFIX)/lib
+	install -d $(DESTDIR)$(TARGET_PREFIX)/lib
-	install -d $(TARGET_PREFIX)/etc
+	install -d $(DESTDIR)$(TARGET_PREFIX)/etc
-	install -d $(TARGET_PREFIX)/sbin
+	install -d $(DESTDIR)$(TARGET_PREFIX)/sbin
-	install -d $(TARGET_PREFIX)/usr/bin
+	install -d $(DESTDIR)$(TARGET_PREFIX)/usr/bin
-	install -m 644 lib/lib*-0.9.5.so $(TARGET_PREFIX)/lib
+	install -m 644 lib/lib*-0.9.5.so $(DESTDIR)$(TARGET_PREFIX)/lib
-	cp -a lib/*.so.* $(TARGET_PREFIX)/lib
+	cp -a lib/*.so.* $(DESTDIR)$(TARGET_PREFIX)/lib
 ifeq ($(LDSO_PRESENT),$(TARGET_ARCH))
 ifeq ($(LDSO_PRESENT),$(TARGET_ARCH))
-	install -m 755 lib/ld-uClibc-0.9.5.so $(TARGET_PREFIX)/lib
+	install -m 755 lib/ld-uClibc-0.9.5.so $(DESTDIR)$(TARGET_PREFIX)/lib
-	install -m 755 ldso/util/ldd $(TARGET_PREFIX)/usr/bin
+	install -m 755 ldso/util/ldd $(DESTDIR)$(TARGET_PREFIX)/usr/bin
-	install -m 755 ldso/util/ldconfig $(TARGET_PREFIX)/sbin
+	install -m 755 ldso/util/readelf $(DESTDIR)$(TARGET_PREFIX)/usr/bin
+	if [ -x ldso/util/ldconfig ] ; then \
+	    install -m 755 ldso/util/ldconfig $(DESTDIR)$(TARGET_PREFIX)/sbin; \
+	fi;
 endif
 endif
 ifeq ($(NATIVE_ARCH), $(TARGET_ARCH))
 ifeq ($(NATIVE_ARCH), $(TARGET_ARCH))
 #	-@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
 #	-@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
@@ -200,19 +203,22 @@ endif
 # libary as the primary libc.
 # libary as the primary libc.
 install_runtime:
 install_runtime:
 ifeq ($(DO_SHARED),shared)
 ifeq ($(DO_SHARED),shared)
-	install -d $(DEVEL_PREFIX)/lib
+	install -d $(DESTDIR)$(DEVEL_PREFIX)/lib
-	install -d $(DEVEL_PREFIX)/etc
+	install -d $(DESTDIR)$(DEVEL_PREFIX)/etc
-	install -d $(DEVEL_PREFIX)/bin
+	install -d $(DESTDIR)$(DEVEL_PREFIX)/bin
-	install -m 644 lib/lib*-0.9.5.so $(DEVEL_PREFIX)/lib
+	install -m 644 lib/lib*-0.9.5.so $(DESTDIR)$(DEVEL_PREFIX)/lib
-	cp -a lib/*.so.* $(DEVEL_PREFIX)/lib
+	cp -a lib/*.so.* $(DESTDIR)$(DEVEL_PREFIX)/lib
 ifeq ($(LDSO_PRESENT),$(TARGET_ARCH))
 ifeq ($(LDSO_PRESENT),$(TARGET_ARCH))
-	install -m 755 lib/ld-uClibc-0.9.5.so $(DEVEL_PREFIX)/lib
+	install -m 755 lib/ld-uClibc-0.9.5.so $(DESTDIR)$(DEVEL_PREFIX)/lib
-	install -m 755 ldso/util/ldd $(DEVEL_PREFIX)/bin
+	install -m 755 ldso/util/ldd $(DESTDIR)$(DEVEL_PREFIX)/bin
-	install -m 755 ldso/util/ldconfig $(DEVEL_PREFIX)/bin
+	install -m 755 ldso/util/readelf $(DESTDIR)$(DEVEL_PREFIX)/bin
-	install -d $(TARGET_PREFIX)/bin
+	install -d $(DESTDIR)$(DEVEL_PREFIX)/bin
-	ln -fs $(DEVEL_PREFIX)/bin/ldd $(TARGET_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldd
+	ln -fs $(DEVEL_PREFIX)/bin/ldd $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldd
-	install -d $(TARGET_PREFIX)/sbin
+	if [ -x ldso/util/ldconfig ] ; then \
-	ln -fs $(DEVEL_PREFIX)/sbin/ldconfig $(TARGET_PREFIX)/sbin/$(TARGET_ARCH)-uclibc-ldconfig
+	    install -m 755 ldso/util/ldconfig $(DESTDIR)$(DEVEL_PREFIX)/bin; \
+	    install -d $(DESTDIR)$(DEVEL_PREFIX)/sbin; \
+	    ln -fs $(DEVEL_PREFIX)/sbin/ldconfig $(DESTDIR)$(DEVEL_PREFIX)/sbin/$(TARGET_ARCH)-uclibc-ldconfig; \
+	fi;
 endif
 endif
 endif
 endif
 
 
@@ -220,17 +226,17 @@ endif
 # Installs header files and development library links.
 # Installs header files and development library links.
 # DEVEL_PREFIX should be $(PREFIX)/$(target)-linux-uclibc/
 # DEVEL_PREFIX should be $(PREFIX)/$(target)-linux-uclibc/
 install_dev:
 install_dev:
-	install -d $(DEVEL_PREFIX)/lib
+	install -d $(DESTDIR)$(DEVEL_PREFIX)/lib
-	install -m 644 lib/*.[ao] $(DEVEL_PREFIX)/lib/
+	install -m 644 lib/*.[ao] $(DESTDIR)$(DEVEL_PREFIX)/lib/
 ifeq ($(DO_SHARED),shared)
 ifeq ($(DO_SHARED),shared)
-	find lib/ -type l -name '*.so' -exec cp -a {} $(DEVEL_PREFIX)/lib ';'
+	find lib/ -type l -name '*.so' -exec cp -a {} $(DESTDIR)$(DEVEL_PREFIX)/lib ';'
 ifeq ($(NATIVE_ARCH), $(TARGET_ARCH))
 ifeq ($(NATIVE_ARCH), $(TARGET_ARCH))
 #	-@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
 #	-@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
 endif
 endif
 endif
 endif
-	install -d $(DEVEL_PREFIX)/include
+	install -d $(DESTDIR)$(DEVEL_PREFIX)/include
 	find include/ -name '*.h' -depth -follow -exec install \
 	find include/ -name '*.h' -depth -follow -exec install \
-	    -D -m 644 {} $(DEVEL_PREFIX)/'{}' ';'
+	    -D -m 644 {} $(DESTDIR)$(DEVEL_PREFIX)/'{}' ';'
 
 
 install_gcc:
 install_gcc:
 	$(MAKE) -C extra/gcc-uClibc install
 	$(MAKE) -C extra/gcc-uClibc install

+ 2 - 1
Rules.mak

@@ -89,13 +89,14 @@ SYSTEM_LDSO=$(shell for each in `$(CC) -print-search-dirs|grep ^libraries|sed -e
 
 
 ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
 ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
 	LDSO=$(TOPDIR)lib/$(UCLIBC_LDSO)
 	LDSO=$(TOPDIR)lib/$(UCLIBC_LDSO)
-	DYNAMIC_LINKER=/lib/$(UCLIBC_LDSO)
+	DYNAMIC_LINKER=$(DESTDIR)$(PREFIX)/lib/$(UCLIBC_LDSO)
 	BUILD_DYNAMIC_LINKER=$(shell cd $(TOPDIR)lib; pwd)/$(UCLIBC_LDSO)
 	BUILD_DYNAMIC_LINKER=$(shell cd $(TOPDIR)lib; pwd)/$(UCLIBC_LDSO)
 else
 else
 	LDSO=$(SYSTEM_LDSO)
 	LDSO=$(SYSTEM_LDSO)
 	DYNAMIC_LINKER=/lib/$(notdir $(SYSTEM_LDSO))
 	DYNAMIC_LINKER=/lib/$(notdir $(SYSTEM_LDSO))
 	BUILD_DYNAMIC_LINKER=$(shell cd $(TOPDIR)lib; pwd)/$(UCLIBC_LDSO)
 	BUILD_DYNAMIC_LINKER=$(shell cd $(TOPDIR)lib; pwd)/$(UCLIBC_LDSO)
 endif
 endif
+LIBRARY_CACHE=#-DUSE_CACHE
 
 
 # Disable libm if HAS_FLOATING_POINT isn't true.
 # Disable libm if HAS_FLOATING_POINT isn't true.
 ifneq ($(HAS_FLOATING_POINT),true)
 ifneq ($(HAS_FLOATING_POINT),true)

+ 22 - 23
extra/Configs/Config.arm

@@ -140,30 +140,29 @@ INCLUDE_IPV6 = false
 DOPIC = false
 DOPIC = false
 
 
 # PREFIX is the directory prefix that is applied to all installed
 # PREFIX is the directory prefix that is applied to all installed
-# files.  Typically, it is set to /usr or /usr/local, although it
+# files.  Typically, it is set to /usr or /usr/local, although it could
-# could also be /opt/vendor_name_here/some/random/path/.  The
+# also be /opt/vendor_name_here/some/random/path/.  The install_runtime
-# install_runtime makefile target installs a few symbolic links
+# makefile target installs a few symbolic links based on PREFIX, not
-# based on PREFIX, not DEVEL_PREFIX.
+# DEVEL_PREFIX.
+#
+# DEVEL_PREFIX is the directory where the development environment will
+# be installed.  The uClibc header files are installed into
+# $(DEVEL_PREFIX)/include, static libraries are installed into
+# $(DEVEL_PREFIX)/lib, etc.  This directory is compiled into the uclibc
+# cross compiler spoofer.  Generally, DEVEL_PREFIX should be set to
+# the same thing as $(PREFIX).  DEVEL_PREFIX is used by the Makefile install 
+# targets install_gcc, install_dev, and install_runtime.
 #
 #
-# DEVEL_PREFIX is the directory into which the development environment
-# will be installed.  Include files are installed into
-# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc.
-# This directory is compiled into the uclibc cross compiler spoofer.
-# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux.
-# DEVEL_PREFIX is used by the Makefile install targets install_gcc,
-# install_dev, and install_runtime.
-# 
 # TARGET_PREFIX is the directory into which the target runtime
 # TARGET_PREFIX is the directory into which the target runtime
-# environment is installed.  The target runtime environment is
+# environment is installed.  The target runtime environment is what one
-# what one would use for a embedded system where uclibc is the
+# would use for a embedded system where uclibc is the native libaray.
-# native libaray.  This will typically be a staging area for
+# This will typically be a staging area for creating a root filesystem
-# creating a root filesystem for the target system, so the default
+# for the target system, so the default is in the local directory.
-# is in the local directory.
 # 
 # 
-# If you want to install to a temporary directory before copying
+# If you want to install to a temporary directory before copying files
-# files to their final location, you can change PREFIX after build
+# to their final location, define DESTDIR during the install step,
-# but before 'make install'.
+# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'.
-PREFIX = /usr
+PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc
-DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc
+DEVEL_PREFIX = $(PREFIX)
-TARGET_PREFIX = $(TOPDIR)/_install
+TARGET_PREFIX = /
 
 

+ 19 - 20
extra/Configs/Config.cross.arm.uclinux

@@ -140,29 +140,28 @@ INCLUDE_IPV6 = false
 DOPIC = false
 DOPIC = false
 
 
 # PREFIX is the directory prefix that is applied to all installed
 # PREFIX is the directory prefix that is applied to all installed
-# files.  Typically, it is set to /usr or /usr/local, although it
+# files.  Typically, it is set to /usr or /usr/local, although it could
-# could also be /opt/vendor_name_here/some/random/path/.  The
+# also be /opt/vendor_name_here/some/random/path/.  The install_runtime
-# install_runtime makefile target installs a few symbolic links
+# makefile target installs a few symbolic links based on PREFIX, not
-# based on PREFIX, not DEVEL_PREFIX.
+# DEVEL_PREFIX.
+#
+# DEVEL_PREFIX is the directory where the development environment will
+# be installed.  The uClibc header files are installed into
+# $(DEVEL_PREFIX)/include, static libraries are installed into
+# $(DEVEL_PREFIX)/lib, etc.  This directory is compiled into the uclibc
+# cross compiler spoofer.  Generally, DEVEL_PREFIX should be set to
+# the same thing as $(PREFIX).  DEVEL_PREFIX is used by the Makefile install 
+# targets install_gcc, install_dev, and install_runtime.
 #
 #
-# DEVEL_PREFIX is the directory into which the development environment
-# will be installed.  Include files are installed into
-# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc.
-# This directory is compiled into the uclibc cross compiler spoofer.
-# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux.
-# DEVEL_PREFIX is used by the Makefile install targets install_gcc,
-# install_dev, and install_runtime.
-# 
 # TARGET_PREFIX is the directory into which the target runtime
 # TARGET_PREFIX is the directory into which the target runtime
-# environment is installed.  The target runtime environment is
+# environment is installed.  The target runtime environment is what one
-# what one would use for a embedded system where uclibc is the
+# would use for a embedded system where uclibc is the native libaray.
-# native libaray.  This will typically be a staging area for
+# This will typically be a staging area for creating a root filesystem
-# creating a root filesystem for the target system, so the default
+# for the target system, so the default is in the local directory.
-# is in the local directory.
 # 
 # 
-# If you want to install to a temporary directory before copying
+# If you want to install to a temporary directory before copying files
-# files to their final location, you can change PREFIX after build
+# to their final location, define DESTDIR during the install step,
-# but before 'make install'.
+# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'.
 PREFIX = /opt/uClinux
 PREFIX = /opt/uClinux
 DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf
 DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf
 TARGET_PREFIX = $(TOPDIR)/_install
 TARGET_PREFIX = $(TOPDIR)/_install

+ 23 - 24
extra/Configs/Config.i386

@@ -45,7 +45,7 @@ STRIPTOOL = $(CROSS)strip
 
 
 # Set the following to `true' to make a debuggable build, and `false' for
 # Set the following to `true' to make a debuggable build, and `false' for
 # production builds.
 # production builds.
-DODEBUG = false
+DODEBUG = true
 
 
 # Compiler warnings you want to see 
 # Compiler warnings you want to see 
 WARNINGS=-Wall
 WARNINGS=-Wall
@@ -140,30 +140,29 @@ INCLUDE_IPV6 = false
 DOPIC = false
 DOPIC = false
 
 
 # PREFIX is the directory prefix that is applied to all installed
 # PREFIX is the directory prefix that is applied to all installed
-# files.  Typically, it is set to /usr or /usr/local, although it
+# files.  Typically, it is set to /usr or /usr/local, although it could
-# could also be /opt/vendor_name_here/some/random/path/.  The
+# also be /opt/vendor_name_here/some/random/path/.  The install_runtime
-# install_runtime makefile target installs a few symbolic links
+# makefile target installs a few symbolic links based on PREFIX, not
-# based on PREFIX, not DEVEL_PREFIX.
+# DEVEL_PREFIX.
+#
+# DEVEL_PREFIX is the directory where the development environment will
+# be installed.  The uClibc header files are installed into
+# $(DEVEL_PREFIX)/include, static libraries are installed into
+# $(DEVEL_PREFIX)/lib, etc.  This directory is compiled into the uclibc
+# cross compiler spoofer.  Generally, DEVEL_PREFIX should be set to
+# the same thing as $(PREFIX).  DEVEL_PREFIX is used by the Makefile install 
+# targets install_gcc, install_dev, and install_runtime.
 #
 #
-# DEVEL_PREFIX is the directory into which the development environment
-# will be installed.  Include files are installed into
-# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc.
-# This directory is compiled into the uclibc cross compiler spoofer.
-# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux.
-# DEVEL_PREFIX is used by the Makefile install targets install_gcc,
-# install_dev, and install_runtime.
-# 
 # TARGET_PREFIX is the directory into which the target runtime
 # TARGET_PREFIX is the directory into which the target runtime
-# environment is installed.  The target runtime environment is
+# environment is installed.  The target runtime environment is what one
-# what one would use for a embedded system where uclibc is the
+# would use for a embedded system where uclibc is the native libaray.
-# native libaray.  This will typically be a staging area for
+# This will typically be a staging area for creating a root filesystem
-# creating a root filesystem for the target system, so the default
+# for the target system, so the default is in the local directory.
-# is in the local directory.
 # 
 # 
-# If you want to install to a temporary directory before copying
+# If you want to install to a temporary directory before copying files
-# files to their final location, you can change PREFIX after build
+# to their final location, define DESTDIR during the install step,
-# but before 'make install'.
+# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'.
-PREFIX = /usr
+PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc
-DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc
+DEVEL_PREFIX = $(PREFIX)
-TARGET_PREFIX = $(TOPDIR)/_install
+TARGET_PREFIX = /
 
 

+ 19 - 20
extra/Configs/Config.m68k

@@ -154,29 +154,28 @@ OPTIMIZATION = $(DEBUG_CFLAGS)
 
 
 
 
 # PREFIX is the directory prefix that is applied to all installed
 # PREFIX is the directory prefix that is applied to all installed
-# files.  Typically, it is set to /usr or /usr/local, although it
+# files.  Typically, it is set to /usr or /usr/local, although it could
-# could also be /opt/vendor_name_here/some/random/path/.  The
+# also be /opt/vendor_name_here/some/random/path/.  The install_runtime
-# install_runtime makefile target installs a few symbolic links
+# makefile target installs a few symbolic links based on PREFIX, not
-# based on PREFIX, not DEVEL_PREFIX.
+# DEVEL_PREFIX.
+#
+# DEVEL_PREFIX is the directory where the development environment will
+# be installed.  The uClibc header files are installed into
+# $(DEVEL_PREFIX)/include, static libraries are installed into
+# $(DEVEL_PREFIX)/lib, etc.  This directory is compiled into the uclibc
+# cross compiler spoofer.  Generally, DEVEL_PREFIX should be set to
+# the same thing as $(PREFIX).  DEVEL_PREFIX is used by the Makefile install 
+# targets install_gcc, install_dev, and install_runtime.
 #
 #
-# DEVEL_PREFIX is the directory into which the development environment
-# will be installed.  Include files are installed into
-# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc.
-# This directory is compiled into the uclibc cross compiler spoofer.
-# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux.
-# DEVEL_PREFIX is used by the Makefile install targets install_gcc,
-# install_dev, and install_runtime.
-# 
 # TARGET_PREFIX is the directory into which the target runtime
 # TARGET_PREFIX is the directory into which the target runtime
-# environment is installed.  The target runtime environment is
+# environment is installed.  The target runtime environment is what one
-# what one would use for a embedded system where uclibc is the
+# would use for a embedded system where uclibc is the native libaray.
-# native libaray.  This will typically be a staging area for
+# This will typically be a staging area for creating a root filesystem
-# creating a root filesystem for the target system, so the default
+# for the target system, so the default is in the local directory.
-# is in the local directory.
 # 
 # 
-# If you want to install to a temporary directory before copying
+# If you want to install to a temporary directory before copying files
-# files to their final location, you can change PREFIX after build
+# to their final location, define DESTDIR during the install step,
-# but before 'make install'.
+# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'.
 PREFIX = /opt/uClinux
 PREFIX = /opt/uClinux
 DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf
 DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf
 TARGET_PREFIX = $(TOPDIR)/_install
 TARGET_PREFIX = $(TOPDIR)/_install

+ 19 - 21
extra/Configs/Config.m68k.coff

@@ -156,30 +156,28 @@ OPTIMIZATION = $(DEBUG_CFLAGS)
 HAVE_ELF = false
 HAVE_ELF = false
 
 
 # PREFIX is the directory prefix that is applied to all installed
 # PREFIX is the directory prefix that is applied to all installed
-# files.  Typically, it is set to /usr or /usr/local, although it
+# files.  Typically, it is set to /usr or /usr/local, although it could
-# could also be /opt/vendor_name_here/some/random/path/.  The
+# also be /opt/vendor_name_here/some/random/path/.  The install_runtime
-# install_runtime makefile target installs a few symbolic links
+# makefile target installs a few symbolic links based on PREFIX, not
-# based on PREFIX, not DEVEL_PREFIX.
+# DEVEL_PREFIX.
+#
+# DEVEL_PREFIX is the directory where the development environment will
+# be installed.  The uClibc header files are installed into
+# $(DEVEL_PREFIX)/include, static libraries are installed into
+# $(DEVEL_PREFIX)/lib, etc.  This directory is compiled into the uclibc
+# cross compiler spoofer.  Generally, DEVEL_PREFIX should be set to
+# the same thing as $(PREFIX).  DEVEL_PREFIX is used by the Makefile install 
+# targets install_gcc, install_dev, and install_runtime.
 #
 #
-# DEVEL_PREFIX is the directory into which the development environment
-# will be installed.  Include files are installed into
-# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc.
-# This directory is compiled into the uclibc cross compiler spoofer.
-# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux.
-# DEVEL_PREFIX is used by the Makefile install targets install_gcc,
-# install_dev, and install_runtime.
-# 
 # TARGET_PREFIX is the directory into which the target runtime
 # TARGET_PREFIX is the directory into which the target runtime
-# environment is installed.  The target runtime environment is
+# environment is installed.  The target runtime environment is what one
-# what one would use for a embedded system where uclibc is the
+# would use for a embedded system where uclibc is the native libaray.
-# native libaray.  This will typically be a staging area for
+# This will typically be a staging area for creating a root filesystem
-# creating a root filesystem for the target system, so the default
+# for the target system, so the default is in the local directory.
-# is in the local directory.
 # 
 # 
-# If you want to install to a temporary directory before copying
+# If you want to install to a temporary directory before copying files
-# files to their final location, you can change PREFIX after build
+# to their final location, define DESTDIR during the install step,
-# but before 'make install'.
+# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'.
-
 PREFIX = /opt/uClinux
 PREFIX = /opt/uClinux
 DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-coff
 DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-coff
 TARGET_PREFIX = $(TOPDIR)/_install
 TARGET_PREFIX = $(TOPDIR)/_install

+ 22 - 23
extra/Configs/Config.mips

@@ -140,30 +140,29 @@ INCLUDE_IPV6 = false
 DOPIC = false
 DOPIC = false
 
 
 # PREFIX is the directory prefix that is applied to all installed
 # PREFIX is the directory prefix that is applied to all installed
-# files.  Typically, it is set to /usr or /usr/local, although it
+# files.  Typically, it is set to /usr or /usr/local, although it could
-# could also be /opt/vendor_name_here/some/random/path/.  The
+# also be /opt/vendor_name_here/some/random/path/.  The install_runtime
-# install_runtime makefile target installs a few symbolic links
+# makefile target installs a few symbolic links based on PREFIX, not
-# based on PREFIX, not DEVEL_PREFIX.
+# DEVEL_PREFIX.
+#
+# DEVEL_PREFIX is the directory where the development environment will
+# be installed.  The uClibc header files are installed into
+# $(DEVEL_PREFIX)/include, static libraries are installed into
+# $(DEVEL_PREFIX)/lib, etc.  This directory is compiled into the uclibc
+# cross compiler spoofer.  Generally, DEVEL_PREFIX should be set to
+# the same thing as $(PREFIX).  DEVEL_PREFIX is used by the Makefile install 
+# targets install_gcc, install_dev, and install_runtime.
 #
 #
-# DEVEL_PREFIX is the directory into which the development environment
-# will be installed.  Include files are installed into
-# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc.
-# This directory is compiled into the uclibc cross compiler spoofer.
-# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux.
-# DEVEL_PREFIX is used by the Makefile install targets install_gcc,
-# install_dev, and install_runtime.
-# 
 # TARGET_PREFIX is the directory into which the target runtime
 # TARGET_PREFIX is the directory into which the target runtime
-# environment is installed.  The target runtime environment is
+# environment is installed.  The target runtime environment is what one
-# what one would use for a embedded system where uclibc is the
+# would use for a embedded system where uclibc is the native libaray.
-# native libaray.  This will typically be a staging area for
+# This will typically be a staging area for creating a root filesystem
-# creating a root filesystem for the target system, so the default
+# for the target system, so the default is in the local directory.
-# is in the local directory.
 # 
 # 
-# If you want to install to a temporary directory before copying
+# If you want to install to a temporary directory before copying files
-# files to their final location, you can change PREFIX after build
+# to their final location, define DESTDIR during the install step,
-# but before 'make install'.
+# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'.
-PREFIX = /usr
+PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc
-DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc
+DEVEL_PREFIX = $(PREFIX)
-TARGET_PREFIX = $(TOPDIR)/_install
+TARGET_PREFIX = /
 
 

+ 22 - 23
extra/Configs/Config.mipsel

@@ -140,30 +140,29 @@ INCLUDE_IPV6 = false
 DOPIC = false
 DOPIC = false
 
 
 # PREFIX is the directory prefix that is applied to all installed
 # PREFIX is the directory prefix that is applied to all installed
-# files.  Typically, it is set to /usr or /usr/local, although it
+# files.  Typically, it is set to /usr or /usr/local, although it could
-# could also be /opt/vendor_name_here/some/random/path/.  The
+# also be /opt/vendor_name_here/some/random/path/.  The install_runtime
-# install_runtime makefile target installs a few symbolic links
+# makefile target installs a few symbolic links based on PREFIX, not
-# based on PREFIX, not DEVEL_PREFIX.
+# DEVEL_PREFIX.
+#
+# DEVEL_PREFIX is the directory where the development environment will
+# be installed.  The uClibc header files are installed into
+# $(DEVEL_PREFIX)/include, static libraries are installed into
+# $(DEVEL_PREFIX)/lib, etc.  This directory is compiled into the uclibc
+# cross compiler spoofer.  Generally, DEVEL_PREFIX should be set to
+# the same thing as $(PREFIX).  DEVEL_PREFIX is used by the Makefile install 
+# targets install_gcc, install_dev, and install_runtime.
 #
 #
-# DEVEL_PREFIX is the directory into which the development environment
-# will be installed.  Include files are installed into
-# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc.
-# This directory is compiled into the uclibc cross compiler spoofer.
-# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux.
-# DEVEL_PREFIX is used by the Makefile install targets install_gcc,
-# install_dev, and install_runtime.
-# 
 # TARGET_PREFIX is the directory into which the target runtime
 # TARGET_PREFIX is the directory into which the target runtime
-# environment is installed.  The target runtime environment is
+# environment is installed.  The target runtime environment is what one
-# what one would use for a embedded system where uclibc is the
+# would use for a embedded system where uclibc is the native libaray.
-# native libaray.  This will typically be a staging area for
+# This will typically be a staging area for creating a root filesystem
-# creating a root filesystem for the target system, so the default
+# for the target system, so the default is in the local directory.
-# is in the local directory.
 # 
 # 
-# If you want to install to a temporary directory before copying
+# If you want to install to a temporary directory before copying files
-# files to their final location, you can change PREFIX after build
+# to their final location, define DESTDIR during the install step,
-# but before 'make install'.
+# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'.
-PREFIX = /usr
+PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc
-DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc
+DEVEL_PREFIX = $(PREFIX)
-TARGET_PREFIX = $(TOPDIR)/_install
+TARGET_PREFIX = /
 
 

+ 21 - 22
extra/Configs/Config.powerpc

@@ -140,30 +140,29 @@ INCLUDE_IPV6 = false
 DOPIC = false
 DOPIC = false
 
 
 # PREFIX is the directory prefix that is applied to all installed
 # PREFIX is the directory prefix that is applied to all installed
-# files.  Typically, it is set to /usr or /usr/local, although it
+# files.  Typically, it is set to /usr or /usr/local, although it could
-# could also be /opt/vendor_name_here/some/random/path/.  The
+# also be /opt/vendor_name_here/some/random/path/.  The install_runtime
-# install_runtime makefile target installs a few symbolic links
+# makefile target installs a few symbolic links based on PREFIX, not
-# based on PREFIX, not DEVEL_PREFIX.
+# DEVEL_PREFIX.
+#
+# DEVEL_PREFIX is the directory where the development environment will
+# be installed.  The uClibc header files are installed into
+# $(DEVEL_PREFIX)/include, static libraries are installed into
+# $(DEVEL_PREFIX)/lib, etc.  This directory is compiled into the uclibc
+# cross compiler spoofer.  Generally, DEVEL_PREFIX should be set to
+# the same thing as $(PREFIX).  DEVEL_PREFIX is used by the Makefile install 
+# targets install_gcc, install_dev, and install_runtime.
 #
 #
-# DEVEL_PREFIX is the directory into which the development environment
-# will be installed.  Include files are installed into
-# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc.
-# This directory is compiled into the uclibc cross compiler spoofer.
-# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux.
-# DEVEL_PREFIX is used by the Makefile install targets install_gcc,
-# install_dev, and install_runtime.
-# 
 # TARGET_PREFIX is the directory into which the target runtime
 # TARGET_PREFIX is the directory into which the target runtime
-# environment is installed.  The target runtime environment is
+# environment is installed.  The target runtime environment is what one
-# what one would use for a embedded system where uclibc is the
+# would use for a embedded system where uclibc is the native libaray.
-# native libaray.  This will typically be a staging area for
+# This will typically be a staging area for creating a root filesystem
-# creating a root filesystem for the target system, so the default
+# for the target system, so the default is in the local directory.
-# is in the local directory.
 # 
 # 
-# If you want to install to a temporary directory before copying
+# If you want to install to a temporary directory before copying files
-# files to their final location, you can change PREFIX after build
+# to their final location, define DESTDIR during the install step,
-# but before 'make install'.
+# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'.
-PREFIX = /usr
+PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc
-DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc
+DEVEL_PREFIX = $(PREFIX)
 TARGET_PREFIX = $(TOPDIR)/_install
 TARGET_PREFIX = $(TOPDIR)/_install
 
 

+ 19 - 20
extra/Configs/Config.sh

@@ -161,29 +161,28 @@ INCLUDE_IPV6 = false
 DOPIC = false
 DOPIC = false
 
 
 # PREFIX is the directory prefix that is applied to all installed
 # PREFIX is the directory prefix that is applied to all installed
-# files.  Typically, it is set to /usr or /usr/local, although it
+# files.  Typically, it is set to /usr or /usr/local, although it could
-# could also be /opt/vendor_name_here/some/random/path/.  The
+# also be /opt/vendor_name_here/some/random/path/.  The install_runtime
-# install_runtime makefile target installs a few symbolic links
+# makefile target installs a few symbolic links based on PREFIX, not
-# based on PREFIX, not DEVEL_PREFIX.
+# DEVEL_PREFIX.
+#
+# DEVEL_PREFIX is the directory where the development environment will
+# be installed.  The uClibc header files are installed into
+# $(DEVEL_PREFIX)/include, static libraries are installed into
+# $(DEVEL_PREFIX)/lib, etc.  This directory is compiled into the uclibc
+# cross compiler spoofer.  Generally, DEVEL_PREFIX should be set to
+# the same thing as $(PREFIX).  DEVEL_PREFIX is used by the Makefile install 
+# targets install_gcc, install_dev, and install_runtime.
 #
 #
-# DEVEL_PREFIX is the directory into which the development environment
-# will be installed.  Include files are installed into
-# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc.
-# This directory is compiled into the uclibc cross compiler spoofer.
-# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux.
-# DEVEL_PREFIX is used by the Makefile install targets install_gcc,
-# install_dev, and install_runtime.
-# 
 # TARGET_PREFIX is the directory into which the target runtime
 # TARGET_PREFIX is the directory into which the target runtime
-# environment is installed.  The target runtime environment is
+# environment is installed.  The target runtime environment is what one
-# what one would use for a embedded system where uclibc is the
+# would use for a embedded system where uclibc is the native libaray.
-# native libaray.  This will typically be a staging area for
+# This will typically be a staging area for creating a root filesystem
-# creating a root filesystem for the target system, so the default
+# for the target system, so the default is in the local directory.
-# is in the local directory.
 # 
 # 
-# If you want to install to a temporary directory before copying
+# If you want to install to a temporary directory before copying files
-# files to their final location, you can change PREFIX after build
+# to their final location, define DESTDIR during the install step,
-# but before 'make install'.
+# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'.
 PREFIX = /opt/uClinux
 PREFIX = /opt/uClinux
 DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf
 DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf
 TARGET_PREFIX = $(TOPDIR)/_install
 TARGET_PREFIX = $(TOPDIR)/_install

+ 10 - 10
extra/gcc-uClibc/Makefile

@@ -11,6 +11,7 @@ all: gcc-uClibc ld-uClibc
 
 
 gcc-uClibc.h: $(TOPDIR)/Config
 gcc-uClibc.h: $(TOPDIR)/Config
 	@echo "/* this file was autogenerated by make */" > gcc-uClibc.h
 	@echo "/* this file was autogenerated by make */" > gcc-uClibc.h
+	@echo "#define UCLIBC_TARGET_PREFIX " \"$(TARGET_PREFIX)\" >> gcc-uClibc.h
 	@echo "#define UCLIBC_DEVEL_PREFIX " \"$(DEVEL_PREFIX)\" >> gcc-uClibc.h
 	@echo "#define UCLIBC_DEVEL_PREFIX " \"$(DEVEL_PREFIX)\" >> gcc-uClibc.h
 	@echo "#define UCLIBC_BUILD_DIR " \"$(UCLIBC_DIR)/\" >> gcc-uClibc.h
 	@echo "#define UCLIBC_BUILD_DIR " \"$(UCLIBC_DIR)/\" >> gcc-uClibc.h
 	@echo "#define GCC_BIN " \"$(GCC_BIN)\" >> gcc-uClibc.h
 	@echo "#define GCC_BIN " \"$(GCC_BIN)\" >> gcc-uClibc.h
@@ -31,18 +32,17 @@ ld-uClibc:
 	chmod a+x $(TARGET_ARCH)-uclibc-ld
 	chmod a+x $(TARGET_ARCH)-uclibc-ld
 
 
 install: all
 install: all
-	install -d $(DEVEL_PREFIX)/bin;
+	install -d $(DESTDIR)$(DEVEL_PREFIX)/bin;
-	install -d $(DEVEL_PREFIX)/usr/bin;
+	install -m 755 $(TARGET_ARCH)-uclibc-gcc $(DESTDIR)$(DEVEL_PREFIX)/bin/
-	install -m 755 $(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/usr/bin/
+	install -m 755 $(TARGET_ARCH)-uclibc-ld $(DESTDIR)$(DEVEL_PREFIX)/bin/
-	install -m 755 $(TARGET_ARCH)-uclibc-ld $(DEVEL_PREFIX)/usr/bin/
+	ln -fs $(TARGET_ARCH)-uclibc-gcc $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-cc
-	ln -fs $(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-cc
+	ln -fs $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(DESTDIR)$(DEVEL_PREFIX)/bin/gcc
-	ln -fs $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/bin/gcc
+	ln -fs $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(DESTDIR)$(DEVEL_PREFIX)/bin/cc
-	ln -fs $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/bin/cc
+	ln -fs $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ld $(DESTDIR)$(DEVEL_PREFIX)/bin/ld
-	ln -fs $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-ld $(DEVEL_PREFIX)/bin/ld
 	for app in addr2line ar as cpp gasp nm objcopy \
 	for app in addr2line ar as cpp gasp nm objcopy \
 	    objdump ranlib size strings strip; do \
 	    objdump ranlib size strings strip; do \
-	  ln -fs `which $(CROSS)$${app}` $(DEVEL_PREFIX)/bin/$${app}; \
+	  ln -fs `which $(CROSS)$${app}` $(DESTDIR)$(DEVEL_PREFIX)/bin/$${app}; \
-	  ln -fs `which $(CROSS)$${app}` $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-$${app}; \
+	  ln -fs `which $(CROSS)$${app}` $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-$${app}; \
 	done
 	done
 
 
 clean:
 clean:

+ 5 - 5
ldso/config.h

@@ -5,11 +5,11 @@
 #  define LDSO_PRELOAD "../util/ld.so.preload"
 #  define LDSO_PRELOAD "../util/ld.so.preload"
 #  define LDDSTUB    "../util/lddstub"
 #  define LDDSTUB    "../util/lddstub"
 #else
 #else
-#  define LDSO_IMAGE UCLIBC_PREFIX "/lib/ld.so"
+#  define LDSO_IMAGE UCLIBC_TARGET_PREFIX "lib/ld.so"
-#  define LDSO_CONF  UCLIBC_PREFIX "/etc/ld.so.conf"
+#  define LDSO_CONF  UCLIBC_TARGET_PREFIX "etc/ld.so.conf"
-#  define LDSO_CACHE UCLIBC_PREFIX "/etc/ld.so.cache"
+#  define LDSO_CACHE UCLIBC_TARGET_PREFIX "etc/ld.so.cache"
-#  define LDSO_PRELOAD UCLIBC_PREFIX "/etc/ld.so.preload"
+#  define LDSO_PRELOAD UCLIBC_TARGET_PREFIX "etc/ld.so.preload"
-#  define LDDSTUB    UCLIBC_PREFIX "/usr/lib/lddstub"
+#  define LDDSTUB    UCLIBC_TARGET_PREFIX "usr/lib/lddstub"
 #endif
 #endif
 
 
 #define LDD_ARGV0    "__LDD_ARGV0"
 #define LDD_ARGV0    "__LDD_ARGV0"

+ 2 - 2
ldso/ldso/Makefile

@@ -24,12 +24,12 @@
 TOPDIR=../../
 TOPDIR=../../
 include $(TOPDIR)Rules.mak
 include $(TOPDIR)Rules.mak
 
 
-TARGET_CFLAGS += #-DUSE_CACHE #-DDL_DEBUG #-funroll-loops
+TARGET_CFLAGS += #-DDL_DEBUG #-funroll-loops
 
 
 
 
 
 
 LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so
 LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so
-TARGET_CFLAGS+=-fPIC -D__PIC__ -DUCLIBC_PREFIX=\"$(PREFIX)\" \
+TARGET_CFLAGS+=-fPIC -D__PIC__ -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
 	-DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
 	-DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
 	-DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR); pwd)\"
 	-DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR); pwd)\"
 CSRC= boot1.c hash.c readelflib1.c $(TARGET_ARCH)/elfinterp.c
 CSRC= boot1.c hash.c readelflib1.c $(TARGET_ARCH)/elfinterp.c

+ 2 - 2
ldso/ldso/dl-elf.c

@@ -249,7 +249,7 @@ struct elf_resolve *_dl_load_shared_library(int secure,
 #endif
 #endif
 
 
 	/* Check in <prefix>/usr/lib */
 	/* Check in <prefix>/usr/lib */
-	pnt1 = UCLIBC_PREFIX "/usr/lib/";
+	pnt1 = UCLIBC_TARGET_PREFIX "/usr/lib/";
 	pnt = mylibname;
 	pnt = mylibname;
 	while (*pnt1)
 	while (*pnt1)
 	    *pnt++ = *pnt1++;
 	    *pnt++ = *pnt1++;
@@ -262,7 +262,7 @@ struct elf_resolve *_dl_load_shared_library(int secure,
 	    return tpnt1;
 	    return tpnt1;
 
 
 	/* Check in <prefix>/lib */
 	/* Check in <prefix>/lib */
-	pnt1 = UCLIBC_PREFIX "/lib/";
+	pnt1 = UCLIBC_TARGET_PREFIX "/lib/";
 	pnt = mylibname;
 	pnt = mylibname;
 	while (*pnt1)
 	while (*pnt1)
 	    *pnt++ = *pnt1++;
 	    *pnt++ = *pnt1++;

+ 2 - 2
ldso/ldso/readelflib1.c

@@ -249,7 +249,7 @@ struct elf_resolve *_dl_load_shared_library(int secure,
 #endif
 #endif
 
 
 	/* Check in <prefix>/usr/lib */
 	/* Check in <prefix>/usr/lib */
-	pnt1 = UCLIBC_PREFIX "/usr/lib/";
+	pnt1 = UCLIBC_TARGET_PREFIX "/usr/lib/";
 	pnt = mylibname;
 	pnt = mylibname;
 	while (*pnt1)
 	while (*pnt1)
 	    *pnt++ = *pnt1++;
 	    *pnt++ = *pnt1++;
@@ -262,7 +262,7 @@ struct elf_resolve *_dl_load_shared_library(int secure,
 	    return tpnt1;
 	    return tpnt1;
 
 
 	/* Check in <prefix>/lib */
 	/* Check in <prefix>/lib */
-	pnt1 = UCLIBC_PREFIX "/lib/";
+	pnt1 = UCLIBC_TARGET_PREFIX "/lib/";
 	pnt = mylibname;
 	pnt = mylibname;
 	while (*pnt1)
 	while (*pnt1)
 	    *pnt++ = *pnt1++;
 	    *pnt++ = *pnt1++;

+ 39 - 11
ldso/libdl/dlib.c

@@ -454,41 +454,69 @@ const char *_dlerror()
 }
 }
 
 
 /* Generate the correct symbols that we need. */
 /* Generate the correct symbols that we need. */
+#if 0
 weak_alias(_dlopen, dlopen);
 weak_alias(_dlopen, dlopen);
 weak_alias(_dlerror, dlerror);
 weak_alias(_dlerror, dlerror);
 weak_alias(_dlclose, dlclose);
 weak_alias(_dlclose, dlclose);
 weak_alias(_dlsym, dlsym);
 weak_alias(_dlsym, dlsym);
 weak_alias(_dladdr, dladdr);
 weak_alias(_dladdr, dladdr);
+#endif
+asm(".weak dlopen;dlopen=_dlopen");
+asm(".weak dlerror;dlerror=_dlerror");
+asm(".weak dlclose;dlclose=_dlclose");
+asm(".weak dlsym;dlsym=_dlsym");
+asm(".weak dladdr;dladdr=_dladdr");
+
 
 
 /* This is a real hack.  We need access to the dynamic linker, but we
 /* This is a real hack.  We need access to the dynamic linker, but we
 also need to make it possible to link against this library without any
 also need to make it possible to link against this library without any
 unresolved externals.  We provide these weak symbols to make the link
 unresolved externals.  We provide these weak symbols to make the link
 possible, but at run time the normal symbols are accessed. */
 possible, but at run time the normal symbols are accessed. */
 
 
-static void foobar()
+static void __attribute__ ((unused)) foobar()
 {
 {
 	_dl_fprintf(2, "libdl library not correctly linked\n");
 	_dl_fprintf(2, "libdl library not correctly linked\n");
 	_dl_exit(1);
 	_dl_exit(1);
 }
 }
 
 
-static int __attribute__ ((unused)) foobar1 = (int) foobar;	/* Use as pointer */
+asm(".weak _dl_fprintf; _dl_fprintf = foobar");
+asm(".weak _dl_find_hash; _dl_find_hash = foobar");
+asm(".weak _dl_load_shared_library; _dl_load_shared_library = foobar");
+asm(".weak _dl_parse_relocation_information; _dl_parse_relocation_information = foobar");
+asm(".weak _dl_parse_lazy_relocation_information; _dl_parse_lazy_relocation_information = foobar");
+#ifdef USE_CACHE
+asm(".weak _dl_map_cache; _dl_map_cache = foobar");
+asm(".weak _dl_unmap_cache; _dl_unmap_cache = foobar");
+#endif	
 
 
+#if 0
+weak_alias(_dl_fprintf, foobar);
 weak_alias(_dl_find_hash, foobar);
 weak_alias(_dl_find_hash, foobar);
-weak_alias(_dl_symbol_tables, foobar1);
-weak_alias(_dl_handles, foobar1);
-weak_alias(_dl_loaded_modules, foobar1);
-weak_alias(_dl_debug_addr, foobar1);
-weak_alias(_dl_error_number, foobar1);
 weak_alias(_dl_load_shared_library, foobar);
 weak_alias(_dl_load_shared_library, foobar);
+weak_alias(_dl_parse_relocation_information, foobar);
+weak_alias(_dl_parse_lazy_relocation_information, foobar);
 #ifdef USE_CACHE
 #ifdef USE_CACHE
 weak_alias(_dl_map_cache, foobar);
 weak_alias(_dl_map_cache, foobar);
 weak_alias(_dl_unmap_cache, foobar);
 weak_alias(_dl_unmap_cache, foobar);
 #endif	
 #endif	
-weak_alias(_dl_malloc_function, foobar1);
+#endif	
-weak_alias(_dl_parse_relocation_information, foobar);
+
-weak_alias(_dl_parse_lazy_relocation_information, foobar);
+static int __attribute__ ((unused)) foobar1 = (int) foobar;	/* Use as pointer */
-weak_alias(_dl_fprintf, foobar);
 
 
+asm(".weak _dl_symbol_tables; _dl_symbol_tables = foobar1");
+asm(".weak _dl_handles; _dl_handles = foobar1");
+asm(".weak _dl_loaded_modules; _dl_loaded_modules = foobar1");
+asm(".weak _dl_debug_addr; _dl_debug_addr = foobar1");
+asm(".weak _dl_error_number; _dl_error_number = foobar1");
+asm(".weak _dl_malloc_function; _dl_malloc_function = foobar1");
+#if 0
+weak_alias(_dl_symbol_tables, foobar1);
+weak_alias(_dl_handles, foobar1);
+weak_alias(_dl_loaded_modules, foobar1);
+weak_alias(_dl_debug_addr, foobar1);
+weak_alias(_dl_error_number, foobar1);
+weak_alias(_dl_malloc_function, foobar1);
+#endif
 
 
 /*
 /*
  * Dump information to stderrr about the current loaded modules
  * Dump information to stderrr about the current loaded modules

+ 39 - 11
ldso/libdl/libdl.c

@@ -454,41 +454,69 @@ const char *_dlerror()
 }
 }
 
 
 /* Generate the correct symbols that we need. */
 /* Generate the correct symbols that we need. */
+#if 0
 weak_alias(_dlopen, dlopen);
 weak_alias(_dlopen, dlopen);
 weak_alias(_dlerror, dlerror);
 weak_alias(_dlerror, dlerror);
 weak_alias(_dlclose, dlclose);
 weak_alias(_dlclose, dlclose);
 weak_alias(_dlsym, dlsym);
 weak_alias(_dlsym, dlsym);
 weak_alias(_dladdr, dladdr);
 weak_alias(_dladdr, dladdr);
+#endif
+asm(".weak dlopen;dlopen=_dlopen");
+asm(".weak dlerror;dlerror=_dlerror");
+asm(".weak dlclose;dlclose=_dlclose");
+asm(".weak dlsym;dlsym=_dlsym");
+asm(".weak dladdr;dladdr=_dladdr");
+
 
 
 /* This is a real hack.  We need access to the dynamic linker, but we
 /* This is a real hack.  We need access to the dynamic linker, but we
 also need to make it possible to link against this library without any
 also need to make it possible to link against this library without any
 unresolved externals.  We provide these weak symbols to make the link
 unresolved externals.  We provide these weak symbols to make the link
 possible, but at run time the normal symbols are accessed. */
 possible, but at run time the normal symbols are accessed. */
 
 
-static void foobar()
+static void __attribute__ ((unused)) foobar()
 {
 {
 	_dl_fprintf(2, "libdl library not correctly linked\n");
 	_dl_fprintf(2, "libdl library not correctly linked\n");
 	_dl_exit(1);
 	_dl_exit(1);
 }
 }
 
 
-static int __attribute__ ((unused)) foobar1 = (int) foobar;	/* Use as pointer */
+asm(".weak _dl_fprintf; _dl_fprintf = foobar");
+asm(".weak _dl_find_hash; _dl_find_hash = foobar");
+asm(".weak _dl_load_shared_library; _dl_load_shared_library = foobar");
+asm(".weak _dl_parse_relocation_information; _dl_parse_relocation_information = foobar");
+asm(".weak _dl_parse_lazy_relocation_information; _dl_parse_lazy_relocation_information = foobar");
+#ifdef USE_CACHE
+asm(".weak _dl_map_cache; _dl_map_cache = foobar");
+asm(".weak _dl_unmap_cache; _dl_unmap_cache = foobar");
+#endif	
 
 
+#if 0
+weak_alias(_dl_fprintf, foobar);
 weak_alias(_dl_find_hash, foobar);
 weak_alias(_dl_find_hash, foobar);
-weak_alias(_dl_symbol_tables, foobar1);
-weak_alias(_dl_handles, foobar1);
-weak_alias(_dl_loaded_modules, foobar1);
-weak_alias(_dl_debug_addr, foobar1);
-weak_alias(_dl_error_number, foobar1);
 weak_alias(_dl_load_shared_library, foobar);
 weak_alias(_dl_load_shared_library, foobar);
+weak_alias(_dl_parse_relocation_information, foobar);
+weak_alias(_dl_parse_lazy_relocation_information, foobar);
 #ifdef USE_CACHE
 #ifdef USE_CACHE
 weak_alias(_dl_map_cache, foobar);
 weak_alias(_dl_map_cache, foobar);
 weak_alias(_dl_unmap_cache, foobar);
 weak_alias(_dl_unmap_cache, foobar);
 #endif	
 #endif	
-weak_alias(_dl_malloc_function, foobar1);
+#endif	
-weak_alias(_dl_parse_relocation_information, foobar);
+
-weak_alias(_dl_parse_lazy_relocation_information, foobar);
+static int __attribute__ ((unused)) foobar1 = (int) foobar;	/* Use as pointer */
-weak_alias(_dl_fprintf, foobar);
 
 
+asm(".weak _dl_symbol_tables; _dl_symbol_tables = foobar1");
+asm(".weak _dl_handles; _dl_handles = foobar1");
+asm(".weak _dl_loaded_modules; _dl_loaded_modules = foobar1");
+asm(".weak _dl_debug_addr; _dl_debug_addr = foobar1");
+asm(".weak _dl_error_number; _dl_error_number = foobar1");
+asm(".weak _dl_malloc_function; _dl_malloc_function = foobar1");
+#if 0
+weak_alias(_dl_symbol_tables, foobar1);
+weak_alias(_dl_handles, foobar1);
+weak_alias(_dl_loaded_modules, foobar1);
+weak_alias(_dl_debug_addr, foobar1);
+weak_alias(_dl_error_number, foobar1);
+weak_alias(_dl_malloc_function, foobar1);
+#endif
 
 
 /*
 /*
  * Dump information to stderrr about the current loaded modules
  * Dump information to stderrr about the current loaded modules

+ 8 - 2
ldso/util/Makefile

@@ -8,7 +8,7 @@ readsoname.o: readsoname.c readsoname2.c
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
     
     
 ldconfig.o: ldconfig.c
 ldconfig.o: ldconfig.c
-	$(TARGET_CC) $(TARGET_CFLAGS) -DUCLIBC_PREFIX=\"$(PREFIX)\" \
+	$(TARGET_CC) $(TARGET_CFLAGS) -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
 		-c $< -o $@
 		-c $< -o $@
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 
@@ -16,14 +16,20 @@ readelf: readelf.c
 	$(TARGET_CC) $(TARGET_CFLAGS) -static readelf.c -o $@
 	$(TARGET_CC) $(TARGET_CFLAGS) -static readelf.c -o $@
 	$(STRIPTOOL) -x -R .note -R .comment $@
 	$(STRIPTOOL) -x -R .note -R .comment $@
 
 
+ifeq ($(strip $(LIBRARY_CACHE)),)
+ldconfig: 
+	echo "LIBRARY_CACHE disabled -- not building ldconfig"
+else
 ldconfig: ldconfig.o readsoname.o
 ldconfig: ldconfig.o readsoname.o
 	$(TARGET_CC) $(TARGET_CFLAGS) -static $^ -o $@
 	$(TARGET_CC) $(TARGET_CFLAGS) -static $^ -o $@
 	$(STRIPTOOL) -x -R .note -R .comment $@
 	$(STRIPTOOL) -x -R .note -R .comment $@
+endif
 
 
 ldd: ldd.c
 ldd: ldd.c
-	$(TARGET_CC) $(TARGET_CFLAGS) -DUCLIBC_PREFIX=\"$(PREFIX)\" \
+	$(TARGET_CC) $(TARGET_CFLAGS) -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
 		-DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
 		-DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
 		-DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR); pwd)\" \
 		-DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR); pwd)\" \
+		-DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" \
 		-static ldd.c -o $@
 		-static ldd.c -o $@
 	$(STRIPTOOL) -x -R .note -R .comment $@
 	$(STRIPTOOL) -x -R .note -R .comment $@
 
 

+ 2 - 2
ldso/util/ldconfig.c

@@ -683,8 +683,8 @@ int main(int argc, char **argv)
 		free(extpath);
 		free(extpath);
 	    }
 	    }
 
 
-	    scan_dir(UCLIBC_PREFIX "/usr/lib");
+	    scan_dir(UCLIBC_TARGET_PREFIX "/usr/lib");
-	    scan_dir(UCLIBC_PREFIX "/lib");
+	    scan_dir(UCLIBC_TARGET_PREFIX "/lib");
 	}
 	}
 
 
 	if (!nocache)
 	if (!nocache)

+ 8 - 0
ldso/util/ldd.c

@@ -222,6 +222,10 @@ static int add_library(Elf32_Ehdr* ehdr, Elf32_Dyn* dynamic, char *strtab, int i
 	if (!s || !strlen(s))
 	if (!s || !strlen(s))
 		return 1;
 		return 1;
 
 
+	/* We add libc.so.0 elsewhere */
+	if (strcmp(s, UCLIBC_LDSO)==0)
+		return 1;
+
 	for (cur = lib_list; cur; cur=cur->next) {
 	for (cur = lib_list; cur; cur=cur->next) {
 		if(strcmp(cur->name, s)==0) {
 		if(strcmp(cur->name, s)==0) {
 			/* Lib is already in the list */
 			/* Lib is already in the list */
@@ -396,9 +400,13 @@ int main( int argc, char** argv)
 
 
 	
 	
 	/* Print the list */
 	/* Print the list */
+	got_em_all=0;
 	for (cur = lib_list; cur; cur=cur->next) {
 	for (cur = lib_list; cur; cur=cur->next) {
+		got_em_all=1;
 		printf("\t%s => %s\n", cur->name, cur->path);
 		printf("\t%s => %s\n", cur->name, cur->path);
 	}
 	}
+	if (got_em_all==0)
+		printf("\tnot a dynamic executable\n");
 
 
 	return 0;
 	return 0;
 }
 }

+ 1 - 4
libc/unistd/getopt.c

@@ -39,10 +39,7 @@ int c;							/* defective option letter */
 	return '?';					/* erroneous-option marker */
 	return '?';					/* erroneous-option marker */
 }
 }
 
 
-extern int getopt (int argc, char *const *argv, const char *optstring)
+int __attribute__ ((__weak__)) getopt (int argc, char *const *argv, const char *optstring)
-	 __attribute__ ((__weak__));
-
-int getopt (int argc, char *const *argv, const char *optstring)
 {
 {
 	static int sp = 1;			/* position within argument */
 	static int sp = 1;			/* position within argument */
 	register int osp;			/* saved `sp' for param test */
 	register int osp;			/* saved `sp' for param test */

+ 4 - 2
test/ctype/Makefile

@@ -1,7 +1,7 @@
 TESTDIR=../
 TESTDIR=../
 include $(TESTDIR)/Rules.mak
 include $(TESTDIR)/Rules.mak
 
 
-TARGETS=ctype
+TARGETS=ctype ctype_run
 all: $(TARGETS)
 all: $(TARGETS)
 
 
 ctype: ctype.c ../testsuite.h Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC)
 ctype: ctype.c ../testsuite.h Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC)
@@ -12,7 +12,9 @@ ctype: ctype.c ../testsuite.h Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(
 	$(CC) $(CFLAGS) -c $< -o $@.o
 	$(CC) $(CFLAGS) -c $< -o $@.o
 	$(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
 	$(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
 	$(STRIPTOOL) -x -R .note -R .comment $@
 	$(STRIPTOOL) -x -R .note -R .comment $@
-	./$@
+
+ctype_run:
+	./ctype
 	-@ echo " "
 	-@ echo " "
 clean:
 clean:
 	rm -f *.[oa] *~ core $(TARGETS)
 	rm -f *.[oa] *~ core $(TARGETS)