diff options
-rw-r--r-- | Makefile | 62 | ||||
-rw-r--r-- | Rules.mak | 3 | ||||
-rw-r--r-- | extra/Configs/Config.arm | 45 | ||||
-rw-r--r-- | extra/Configs/Config.cross.arm.uclinux | 39 | ||||
-rw-r--r-- | extra/Configs/Config.i386 | 47 | ||||
-rw-r--r-- | extra/Configs/Config.m68k | 39 | ||||
-rw-r--r-- | extra/Configs/Config.m68k.coff | 40 | ||||
-rw-r--r-- | extra/Configs/Config.mips | 45 | ||||
-rw-r--r-- | extra/Configs/Config.mipsel | 45 | ||||
-rw-r--r-- | extra/Configs/Config.powerpc | 43 | ||||
-rw-r--r-- | extra/Configs/Config.sh | 39 | ||||
-rw-r--r-- | extra/gcc-uClibc/Makefile | 20 | ||||
-rw-r--r-- | ldso/config.h | 10 | ||||
-rw-r--r-- | ldso/ldso/Makefile | 4 | ||||
-rw-r--r-- | ldso/ldso/dl-elf.c | 4 | ||||
-rw-r--r-- | ldso/ldso/readelflib1.c | 4 | ||||
-rw-r--r-- | ldso/libdl/dlib.c | 50 | ||||
-rw-r--r-- | ldso/libdl/libdl.c | 50 | ||||
-rw-r--r-- | ldso/util/Makefile | 10 | ||||
-rw-r--r-- | ldso/util/ldconfig.c | 4 | ||||
-rw-r--r-- | ldso/util/ldd.c | 8 | ||||
-rw-r--r-- | libc/unistd/getopt.c | 5 | ||||
-rw-r--r-- | test/ctype/Makefile | 6 |
23 files changed, 344 insertions, 278 deletions
@@ -43,9 +43,9 @@ Config: shared: @$(MAKE) -C libc shared - @$(MAKE) -C ldso/util + @$(MAKE) -C $(LIBRARY_CACHE) ldso/util ifeq ($(LDSO_PRESENT), $(TARGET_ARCH)) - @$(MAKE) -C ldso shared + @$(MAKE) -C $(LIBRARY_CACHE) ldso shared endif @$(MAKE) -C libcrypt shared @$(MAKE) -C libutil shared @@ -178,16 +178,19 @@ install: install_dev install_runtime install_gcc # directory. install_target: ifeq ($(DO_SHARED),shared) - install -d $(TARGET_PREFIX)/lib - install -d $(TARGET_PREFIX)/etc - install -d $(TARGET_PREFIX)/sbin - install -d $(TARGET_PREFIX)/usr/bin - install -m 644 lib/lib*-0.9.5.so $(TARGET_PREFIX)/lib - cp -a lib/*.so.* $(TARGET_PREFIX)/lib + install -d $(DESTDIR)$(TARGET_PREFIX)/lib + install -d $(DESTDIR)$(TARGET_PREFIX)/etc + install -d $(DESTDIR)$(TARGET_PREFIX)/sbin + install -d $(DESTDIR)$(TARGET_PREFIX)/usr/bin + install -m 644 lib/lib*-0.9.5.so $(DESTDIR)$(TARGET_PREFIX)/lib + cp -a lib/*.so.* $(DESTDIR)$(TARGET_PREFIX)/lib ifeq ($(LDSO_PRESENT),$(TARGET_ARCH)) - install -m 755 lib/ld-uClibc-0.9.5.so $(TARGET_PREFIX)/lib - install -m 755 ldso/util/ldd $(TARGET_PREFIX)/usr/bin - install -m 755 ldso/util/ldconfig $(TARGET_PREFIX)/sbin + install -m 755 lib/ld-uClibc-0.9.5.so $(DESTDIR)$(TARGET_PREFIX)/lib + install -m 755 ldso/util/ldd $(DESTDIR)$(TARGET_PREFIX)/usr/bin + 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 ifeq ($(NATIVE_ARCH), $(TARGET_ARCH)) # -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi @@ -200,19 +203,22 @@ endif # libary as the primary libc. install_runtime: ifeq ($(DO_SHARED),shared) - install -d $(DEVEL_PREFIX)/lib - install -d $(DEVEL_PREFIX)/etc - install -d $(DEVEL_PREFIX)/bin - install -m 644 lib/lib*-0.9.5.so $(DEVEL_PREFIX)/lib - cp -a lib/*.so.* $(DEVEL_PREFIX)/lib + install -d $(DESTDIR)$(DEVEL_PREFIX)/lib + install -d $(DESTDIR)$(DEVEL_PREFIX)/etc + install -d $(DESTDIR)$(DEVEL_PREFIX)/bin + install -m 644 lib/lib*-0.9.5.so $(DESTDIR)$(DEVEL_PREFIX)/lib + cp -a lib/*.so.* $(DESTDIR)$(DEVEL_PREFIX)/lib ifeq ($(LDSO_PRESENT),$(TARGET_ARCH)) - install -m 755 lib/ld-uClibc-0.9.5.so $(DEVEL_PREFIX)/lib - install -m 755 ldso/util/ldd $(DEVEL_PREFIX)/bin - install -m 755 ldso/util/ldconfig $(DEVEL_PREFIX)/bin - install -d $(TARGET_PREFIX)/bin - ln -fs $(DEVEL_PREFIX)/bin/ldd $(TARGET_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldd - install -d $(TARGET_PREFIX)/sbin - ln -fs $(DEVEL_PREFIX)/sbin/ldconfig $(TARGET_PREFIX)/sbin/$(TARGET_ARCH)-uclibc-ldconfig + install -m 755 lib/ld-uClibc-0.9.5.so $(DESTDIR)$(DEVEL_PREFIX)/lib + install -m 755 ldso/util/ldd $(DESTDIR)$(DEVEL_PREFIX)/bin + install -m 755 ldso/util/readelf $(DESTDIR)$(DEVEL_PREFIX)/bin + install -d $(DESTDIR)$(DEVEL_PREFIX)/bin + ln -fs $(DEVEL_PREFIX)/bin/ldd $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldd + if [ -x ldso/util/ldconfig ] ; then \ + 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 @@ -220,17 +226,17 @@ endif # Installs header files and development library links. # DEVEL_PREFIX should be $(PREFIX)/$(target)-linux-uclibc/ install_dev: - install -d $(DEVEL_PREFIX)/lib - install -m 644 lib/*.[ao] $(DEVEL_PREFIX)/lib/ + install -d $(DESTDIR)$(DEVEL_PREFIX)/lib + install -m 644 lib/*.[ao] $(DESTDIR)$(DEVEL_PREFIX)/lib/ 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)) # -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi endif endif - install -d $(DEVEL_PREFIX)/include + install -d $(DESTDIR)$(DEVEL_PREFIX)/include find include/ -name '*.h' -depth -follow -exec install \ - -D -m 644 {} $(DEVEL_PREFIX)/'{}' ';' + -D -m 644 {} $(DESTDIR)$(DEVEL_PREFIX)/'{}' ';' install_gcc: $(MAKE) -C extra/gcc-uClibc install @@ -89,13 +89,14 @@ SYSTEM_LDSO=$(shell for each in `$(CC) -print-search-dirs|grep ^libraries|sed -e ifeq ($(LDSO_PRESENT), $(TARGET_ARCH)) 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) else LDSO=$(SYSTEM_LDSO) DYNAMIC_LINKER=/lib/$(notdir $(SYSTEM_LDSO)) BUILD_DYNAMIC_LINKER=$(shell cd $(TOPDIR)lib; pwd)/$(UCLIBC_LDSO) endif +LIBRARY_CACHE=#-DUSE_CACHE # Disable libm if HAS_FLOATING_POINT isn't true. ifneq ($(HAS_FLOATING_POINT),true) diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm index d47d3c033..ee2d52804 100644 --- a/extra/Configs/Config.arm +++ b/extra/Configs/Config.arm @@ -140,30 +140,29 @@ INCLUDE_IPV6 = false DOPIC = false # PREFIX is the directory prefix that is applied to all installed -# files. Typically, it is set to /usr or /usr/local, although it -# could also be /opt/vendor_name_here/some/random/path/. The -# install_runtime makefile target installs a few symbolic links -# based on PREFIX, not DEVEL_PREFIX. +# files. Typically, it is set to /usr or /usr/local, although it could +# also be /opt/vendor_name_here/some/random/path/. The install_runtime +# makefile target installs a few symbolic links based on PREFIX, not +# 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 -# environment is installed. The target runtime environment is -# what one would use for a embedded system where uclibc is the -# native libaray. This will typically be a staging area for -# creating a root filesystem for the target system, so the default -# is in the local directory. +# environment is installed. The target runtime environment is what one +# would use for a embedded system where uclibc is the native libaray. +# This will typically be a staging area for creating a root filesystem +# for the target system, so the default is in the local directory. # -# If you want to install to a temporary directory before copying -# files to their final location, you can change PREFIX after build -# but before 'make install'. -PREFIX = /usr -DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc -TARGET_PREFIX = $(TOPDIR)/_install +# If you want to install to a temporary directory before copying files +# to their final location, define DESTDIR during the install step, +# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'. +PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc +DEVEL_PREFIX = $(PREFIX) +TARGET_PREFIX = / diff --git a/extra/Configs/Config.cross.arm.uclinux b/extra/Configs/Config.cross.arm.uclinux index ea6fcd16b..344273efb 100644 --- a/extra/Configs/Config.cross.arm.uclinux +++ b/extra/Configs/Config.cross.arm.uclinux @@ -140,29 +140,28 @@ INCLUDE_IPV6 = false DOPIC = false # PREFIX is the directory prefix that is applied to all installed -# files. Typically, it is set to /usr or /usr/local, although it -# could also be /opt/vendor_name_here/some/random/path/. The -# install_runtime makefile target installs a few symbolic links -# based on PREFIX, not DEVEL_PREFIX. +# files. Typically, it is set to /usr or /usr/local, although it could +# also be /opt/vendor_name_here/some/random/path/. The install_runtime +# makefile target installs a few symbolic links based on PREFIX, not +# 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 -# environment is installed. The target runtime environment is -# what one would use for a embedded system where uclibc is the -# native libaray. This will typically be a staging area for -# creating a root filesystem for the target system, so the default -# is in the local directory. +# environment is installed. The target runtime environment is what one +# would use for a embedded system where uclibc is the native libaray. +# This will typically be a staging area for creating a root filesystem +# for the target system, so the default is in the local directory. # -# If you want to install to a temporary directory before copying -# files to their final location, you can change PREFIX after build -# but before 'make install'. +# If you want to install to a temporary directory before copying files +# to their final location, define DESTDIR during the install step, +# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'. PREFIX = /opt/uClinux DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf TARGET_PREFIX = $(TOPDIR)/_install diff --git a/extra/Configs/Config.i386 b/extra/Configs/Config.i386 index 387240fdc..7eb9a0095 100644 --- a/extra/Configs/Config.i386 +++ b/extra/Configs/Config.i386 @@ -45,7 +45,7 @@ STRIPTOOL = $(CROSS)strip # Set the following to `true' to make a debuggable build, and `false' for # production builds. -DODEBUG = false +DODEBUG = true # Compiler warnings you want to see WARNINGS=-Wall @@ -140,30 +140,29 @@ INCLUDE_IPV6 = false DOPIC = false # PREFIX is the directory prefix that is applied to all installed -# files. Typically, it is set to /usr or /usr/local, although it -# could also be /opt/vendor_name_here/some/random/path/. The -# install_runtime makefile target installs a few symbolic links -# based on PREFIX, not DEVEL_PREFIX. +# files. Typically, it is set to /usr or /usr/local, although it could +# also be /opt/vendor_name_here/some/random/path/. The install_runtime +# makefile target installs a few symbolic links based on PREFIX, not +# 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 -# environment is installed. The target runtime environment is -# what one would use for a embedded system where uclibc is the -# native libaray. This will typically be a staging area for -# creating a root filesystem for the target system, so the default -# is in the local directory. +# environment is installed. The target runtime environment is what one +# would use for a embedded system where uclibc is the native libaray. +# This will typically be a staging area for creating a root filesystem +# for the target system, so the default is in the local directory. # -# If you want to install to a temporary directory before copying -# files to their final location, you can change PREFIX after build -# but before 'make install'. -PREFIX = /usr -DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc -TARGET_PREFIX = $(TOPDIR)/_install +# If you want to install to a temporary directory before copying files +# to their final location, define DESTDIR during the install step, +# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'. +PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc +DEVEL_PREFIX = $(PREFIX) +TARGET_PREFIX = / diff --git a/extra/Configs/Config.m68k b/extra/Configs/Config.m68k index ef8f4045d..b9447b844 100644 --- a/extra/Configs/Config.m68k +++ b/extra/Configs/Config.m68k @@ -154,29 +154,28 @@ OPTIMIZATION = $(DEBUG_CFLAGS) # PREFIX is the directory prefix that is applied to all installed -# files. Typically, it is set to /usr or /usr/local, although it -# could also be /opt/vendor_name_here/some/random/path/. The -# install_runtime makefile target installs a few symbolic links -# based on PREFIX, not DEVEL_PREFIX. +# files. Typically, it is set to /usr or /usr/local, although it could +# also be /opt/vendor_name_here/some/random/path/. The install_runtime +# makefile target installs a few symbolic links based on PREFIX, not +# 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 -# environment is installed. The target runtime environment is -# what one would use for a embedded system where uclibc is the -# native libaray. This will typically be a staging area for -# creating a root filesystem for the target system, so the default -# is in the local directory. +# environment is installed. The target runtime environment is what one +# would use for a embedded system where uclibc is the native libaray. +# This will typically be a staging area for creating a root filesystem +# for the target system, so the default is in the local directory. # -# If you want to install to a temporary directory before copying -# files to their final location, you can change PREFIX after build -# but before 'make install'. +# If you want to install to a temporary directory before copying files +# to their final location, define DESTDIR during the install step, +# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'. PREFIX = /opt/uClinux DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf TARGET_PREFIX = $(TOPDIR)/_install diff --git a/extra/Configs/Config.m68k.coff b/extra/Configs/Config.m68k.coff index 8fb8b83f2..541089407 100644 --- a/extra/Configs/Config.m68k.coff +++ b/extra/Configs/Config.m68k.coff @@ -156,30 +156,28 @@ OPTIMIZATION = $(DEBUG_CFLAGS) HAVE_ELF = false # PREFIX is the directory prefix that is applied to all installed -# files. Typically, it is set to /usr or /usr/local, although it -# could also be /opt/vendor_name_here/some/random/path/. The -# install_runtime makefile target installs a few symbolic links -# based on PREFIX, not DEVEL_PREFIX. +# files. Typically, it is set to /usr or /usr/local, although it could +# also be /opt/vendor_name_here/some/random/path/. The install_runtime +# makefile target installs a few symbolic links based on PREFIX, not +# 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 -# environment is installed. The target runtime environment is -# what one would use for a embedded system where uclibc is the -# native libaray. This will typically be a staging area for -# creating a root filesystem for the target system, so the default -# is in the local directory. +# environment is installed. The target runtime environment is what one +# would use for a embedded system where uclibc is the native libaray. +# This will typically be a staging area for creating a root filesystem +# for the target system, so the default is in the local directory. # -# If you want to install to a temporary directory before copying -# files to their final location, you can change PREFIX after build -# but before 'make install'. - +# If you want to install to a temporary directory before copying files +# to their final location, define DESTDIR during the install step, +# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'. PREFIX = /opt/uClinux DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-coff TARGET_PREFIX = $(TOPDIR)/_install diff --git a/extra/Configs/Config.mips b/extra/Configs/Config.mips index 7c111a505..4f8a38c7f 100644 --- a/extra/Configs/Config.mips +++ b/extra/Configs/Config.mips @@ -140,30 +140,29 @@ INCLUDE_IPV6 = false DOPIC = false # PREFIX is the directory prefix that is applied to all installed -# files. Typically, it is set to /usr or /usr/local, although it -# could also be /opt/vendor_name_here/some/random/path/. The -# install_runtime makefile target installs a few symbolic links -# based on PREFIX, not DEVEL_PREFIX. +# files. Typically, it is set to /usr or /usr/local, although it could +# also be /opt/vendor_name_here/some/random/path/. The install_runtime +# makefile target installs a few symbolic links based on PREFIX, not +# 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 -# environment is installed. The target runtime environment is -# what one would use for a embedded system where uclibc is the -# native libaray. This will typically be a staging area for -# creating a root filesystem for the target system, so the default -# is in the local directory. +# environment is installed. The target runtime environment is what one +# would use for a embedded system where uclibc is the native libaray. +# This will typically be a staging area for creating a root filesystem +# for the target system, so the default is in the local directory. # -# If you want to install to a temporary directory before copying -# files to their final location, you can change PREFIX after build -# but before 'make install'. -PREFIX = /usr -DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc -TARGET_PREFIX = $(TOPDIR)/_install +# If you want to install to a temporary directory before copying files +# to their final location, define DESTDIR during the install step, +# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'. +PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc +DEVEL_PREFIX = $(PREFIX) +TARGET_PREFIX = / diff --git a/extra/Configs/Config.mipsel b/extra/Configs/Config.mipsel index 7c111a505..4f8a38c7f 100644 --- a/extra/Configs/Config.mipsel +++ b/extra/Configs/Config.mipsel @@ -140,30 +140,29 @@ INCLUDE_IPV6 = false DOPIC = false # PREFIX is the directory prefix that is applied to all installed -# files. Typically, it is set to /usr or /usr/local, although it -# could also be /opt/vendor_name_here/some/random/path/. The -# install_runtime makefile target installs a few symbolic links -# based on PREFIX, not DEVEL_PREFIX. +# files. Typically, it is set to /usr or /usr/local, although it could +# also be /opt/vendor_name_here/some/random/path/. The install_runtime +# makefile target installs a few symbolic links based on PREFIX, not +# 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 -# environment is installed. The target runtime environment is -# what one would use for a embedded system where uclibc is the -# native libaray. This will typically be a staging area for -# creating a root filesystem for the target system, so the default -# is in the local directory. +# environment is installed. The target runtime environment is what one +# would use for a embedded system where uclibc is the native libaray. +# This will typically be a staging area for creating a root filesystem +# for the target system, so the default is in the local directory. # -# If you want to install to a temporary directory before copying -# files to their final location, you can change PREFIX after build -# but before 'make install'. -PREFIX = /usr -DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc -TARGET_PREFIX = $(TOPDIR)/_install +# If you want to install to a temporary directory before copying files +# to their final location, define DESTDIR during the install step, +# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'. +PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc +DEVEL_PREFIX = $(PREFIX) +TARGET_PREFIX = / diff --git a/extra/Configs/Config.powerpc b/extra/Configs/Config.powerpc index 1bc4978d6..2e2aa692e 100644 --- a/extra/Configs/Config.powerpc +++ b/extra/Configs/Config.powerpc @@ -140,30 +140,29 @@ INCLUDE_IPV6 = false DOPIC = false # PREFIX is the directory prefix that is applied to all installed -# files. Typically, it is set to /usr or /usr/local, although it -# could also be /opt/vendor_name_here/some/random/path/. The -# install_runtime makefile target installs a few symbolic links -# based on PREFIX, not DEVEL_PREFIX. +# files. Typically, it is set to /usr or /usr/local, although it could +# also be /opt/vendor_name_here/some/random/path/. The install_runtime +# makefile target installs a few symbolic links based on PREFIX, not +# 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 -# environment is installed. The target runtime environment is -# what one would use for a embedded system where uclibc is the -# native libaray. This will typically be a staging area for -# creating a root filesystem for the target system, so the default -# is in the local directory. +# environment is installed. The target runtime environment is what one +# would use for a embedded system where uclibc is the native libaray. +# This will typically be a staging area for creating a root filesystem +# for the target system, so the default is in the local directory. # -# If you want to install to a temporary directory before copying -# files to their final location, you can change PREFIX after build -# but before 'make install'. -PREFIX = /usr -DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc +# If you want to install to a temporary directory before copying files +# to their final location, define DESTDIR during the install step, +# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'. +PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc +DEVEL_PREFIX = $(PREFIX) TARGET_PREFIX = $(TOPDIR)/_install diff --git a/extra/Configs/Config.sh b/extra/Configs/Config.sh index 6e36ccee8..dc8cb0c35 100644 --- a/extra/Configs/Config.sh +++ b/extra/Configs/Config.sh @@ -161,29 +161,28 @@ INCLUDE_IPV6 = false DOPIC = false # PREFIX is the directory prefix that is applied to all installed -# files. Typically, it is set to /usr or /usr/local, although it -# could also be /opt/vendor_name_here/some/random/path/. The -# install_runtime makefile target installs a few symbolic links -# based on PREFIX, not DEVEL_PREFIX. +# files. Typically, it is set to /usr or /usr/local, although it could +# also be /opt/vendor_name_here/some/random/path/. The install_runtime +# makefile target installs a few symbolic links based on PREFIX, not +# 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 -# environment is installed. The target runtime environment is -# what one would use for a embedded system where uclibc is the -# native libaray. This will typically be a staging area for -# creating a root filesystem for the target system, so the default -# is in the local directory. +# environment is installed. The target runtime environment is what one +# would use for a embedded system where uclibc is the native libaray. +# This will typically be a staging area for creating a root filesystem +# for the target system, so the default is in the local directory. # -# If you want to install to a temporary directory before copying -# files to their final location, you can change PREFIX after build -# but before 'make install'. +# If you want to install to a temporary directory before copying files +# to their final location, define DESTDIR during the install step, +# i.e., 'make install DESTDIR=/home/foo/uclibc/_install'. PREFIX = /opt/uClinux DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf TARGET_PREFIX = $(TOPDIR)/_install diff --git a/extra/gcc-uClibc/Makefile b/extra/gcc-uClibc/Makefile index e91a2550e..bb80345bb 100644 --- a/extra/gcc-uClibc/Makefile +++ b/extra/gcc-uClibc/Makefile @@ -11,6 +11,7 @@ all: gcc-uClibc ld-uClibc gcc-uClibc.h: $(TOPDIR)/Config @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_BUILD_DIR " \"$(UCLIBC_DIR)/\" >> 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 install: all - install -d $(DEVEL_PREFIX)/bin; - install -d $(DEVEL_PREFIX)/usr/bin; - install -m 755 $(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/usr/bin/ - install -m 755 $(TARGET_ARCH)-uclibc-ld $(DEVEL_PREFIX)/usr/bin/ - ln -fs $(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-cc - ln -fs $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/bin/gcc - ln -fs $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/bin/cc - ln -fs $(DEVEL_PREFIX)/usr/bin/$(TARGET_ARCH)-uclibc-ld $(DEVEL_PREFIX)/bin/ld + install -d $(DESTDIR)$(DEVEL_PREFIX)/bin; + install -m 755 $(TARGET_ARCH)-uclibc-gcc $(DESTDIR)$(DEVEL_PREFIX)/bin/ + install -m 755 $(TARGET_ARCH)-uclibc-ld $(DESTDIR)$(DEVEL_PREFIX)/bin/ + ln -fs $(TARGET_ARCH)-uclibc-gcc $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-cc + ln -fs $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(DESTDIR)$(DEVEL_PREFIX)/bin/gcc + ln -fs $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(DESTDIR)$(DEVEL_PREFIX)/bin/cc + ln -fs $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ld $(DESTDIR)$(DEVEL_PREFIX)/bin/ld for app in addr2line ar as cpp gasp nm objcopy \ objdump ranlib size strings strip; do \ - ln -fs `which $(CROSS)$${app}` $(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/$${app}; \ + ln -fs `which $(CROSS)$${app}` $(DESTDIR)$(DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-$${app}; \ done clean: diff --git a/ldso/config.h b/ldso/config.h index 256bab271..499101885 100644 --- a/ldso/config.h +++ b/ldso/config.h @@ -5,11 +5,11 @@ # define LDSO_PRELOAD "../util/ld.so.preload" # define LDDSTUB "../util/lddstub" #else -# define LDSO_IMAGE UCLIBC_PREFIX "/lib/ld.so" -# define LDSO_CONF UCLIBC_PREFIX "/etc/ld.so.conf" -# define LDSO_CACHE UCLIBC_PREFIX "/etc/ld.so.cache" -# define LDSO_PRELOAD UCLIBC_PREFIX "/etc/ld.so.preload" -# define LDDSTUB UCLIBC_PREFIX "/usr/lib/lddstub" +# define LDSO_IMAGE UCLIBC_TARGET_PREFIX "lib/ld.so" +# define LDSO_CONF UCLIBC_TARGET_PREFIX "etc/ld.so.conf" +# define LDSO_CACHE UCLIBC_TARGET_PREFIX "etc/ld.so.cache" +# define LDSO_PRELOAD UCLIBC_TARGET_PREFIX "etc/ld.so.preload" +# define LDDSTUB UCLIBC_TARGET_PREFIX "usr/lib/lddstub" #endif #define LDD_ARGV0 "__LDD_ARGV0" diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile index 95ed01caf..617784ec9 100644 --- a/ldso/ldso/Makefile +++ b/ldso/ldso/Makefile @@ -24,12 +24,12 @@ TOPDIR=../../ 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 -TARGET_CFLAGS+=-fPIC -D__PIC__ -DUCLIBC_PREFIX=\"$(PREFIX)\" \ +TARGET_CFLAGS+=-fPIC -D__PIC__ -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \ -DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \ -DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR); pwd)\" CSRC= boot1.c hash.c readelflib1.c $(TARGET_ARCH)/elfinterp.c diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 049452bfa..ebc9bc8dc 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -249,7 +249,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, #endif /* Check in <prefix>/usr/lib */ - pnt1 = UCLIBC_PREFIX "/usr/lib/"; + pnt1 = UCLIBC_TARGET_PREFIX "/usr/lib/"; pnt = mylibname; while (*pnt1) *pnt++ = *pnt1++; @@ -262,7 +262,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, return tpnt1; /* Check in <prefix>/lib */ - pnt1 = UCLIBC_PREFIX "/lib/"; + pnt1 = UCLIBC_TARGET_PREFIX "/lib/"; pnt = mylibname; while (*pnt1) *pnt++ = *pnt1++; diff --git a/ldso/ldso/readelflib1.c b/ldso/ldso/readelflib1.c index 049452bfa..ebc9bc8dc 100644 --- a/ldso/ldso/readelflib1.c +++ b/ldso/ldso/readelflib1.c @@ -249,7 +249,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, #endif /* Check in <prefix>/usr/lib */ - pnt1 = UCLIBC_PREFIX "/usr/lib/"; + pnt1 = UCLIBC_TARGET_PREFIX "/usr/lib/"; pnt = mylibname; while (*pnt1) *pnt++ = *pnt1++; @@ -262,7 +262,7 @@ struct elf_resolve *_dl_load_shared_library(int secure, return tpnt1; /* Check in <prefix>/lib */ - pnt1 = UCLIBC_PREFIX "/lib/"; + pnt1 = UCLIBC_TARGET_PREFIX "/lib/"; pnt = mylibname; while (*pnt1) *pnt++ = *pnt1++; diff --git a/ldso/libdl/dlib.c b/ldso/libdl/dlib.c index 2b6000472..7664f3fd4 100644 --- a/ldso/libdl/dlib.c +++ b/ldso/libdl/dlib.c @@ -454,41 +454,69 @@ const char *_dlerror() } /* Generate the correct symbols that we need. */ +#if 0 weak_alias(_dlopen, dlopen); weak_alias(_dlerror, dlerror); weak_alias(_dlclose, dlclose); weak_alias(_dlsym, dlsym); 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 also need to make it possible to link against this library without any unresolved externals. We provide these weak symbols to make the link 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_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_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_parse_relocation_information, foobar); +weak_alias(_dl_parse_lazy_relocation_information, foobar); #ifdef USE_CACHE weak_alias(_dl_map_cache, foobar); weak_alias(_dl_unmap_cache, foobar); #endif -weak_alias(_dl_malloc_function, foobar1); -weak_alias(_dl_parse_relocation_information, foobar); -weak_alias(_dl_parse_lazy_relocation_information, foobar); -weak_alias(_dl_fprintf, foobar); +#endif + +static int __attribute__ ((unused)) foobar1 = (int) foobar; /* Use as pointer */ +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 diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index 2b6000472..7664f3fd4 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -454,41 +454,69 @@ const char *_dlerror() } /* Generate the correct symbols that we need. */ +#if 0 weak_alias(_dlopen, dlopen); weak_alias(_dlerror, dlerror); weak_alias(_dlclose, dlclose); weak_alias(_dlsym, dlsym); 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 also need to make it possible to link against this library without any unresolved externals. We provide these weak symbols to make the link 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_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_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_parse_relocation_information, foobar); +weak_alias(_dl_parse_lazy_relocation_information, foobar); #ifdef USE_CACHE weak_alias(_dl_map_cache, foobar); weak_alias(_dl_unmap_cache, foobar); #endif -weak_alias(_dl_malloc_function, foobar1); -weak_alias(_dl_parse_relocation_information, foobar); -weak_alias(_dl_parse_lazy_relocation_information, foobar); -weak_alias(_dl_fprintf, foobar); +#endif + +static int __attribute__ ((unused)) foobar1 = (int) foobar; /* Use as pointer */ +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 diff --git a/ldso/util/Makefile b/ldso/util/Makefile index a5eb9ad6c..baa3fa897 100644 --- a/ldso/util/Makefile +++ b/ldso/util/Makefile @@ -8,7 +8,7 @@ readsoname.o: readsoname.c readsoname2.c $(STRIPTOOL) -x -R .note -R .comment $*.o ldconfig.o: ldconfig.c - $(TARGET_CC) $(TARGET_CFLAGS) -DUCLIBC_PREFIX=\"$(PREFIX)\" \ + $(TARGET_CC) $(TARGET_CFLAGS) -DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \ -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o @@ -16,14 +16,20 @@ readelf: readelf.c $(TARGET_CC) $(TARGET_CFLAGS) -static readelf.c -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ +ifeq ($(strip $(LIBRARY_CACHE)),) +ldconfig: + echo "LIBRARY_CACHE disabled -- not building ldconfig" +else ldconfig: ldconfig.o readsoname.o $(TARGET_CC) $(TARGET_CFLAGS) -static $^ -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ +endif 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_BUILD_DIR=\"$(shell cd $(TOPDIR); pwd)\" \ + -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" \ -static ldd.c -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ diff --git a/ldso/util/ldconfig.c b/ldso/util/ldconfig.c index 054b82a93..63765a78c 100644 --- a/ldso/util/ldconfig.c +++ b/ldso/util/ldconfig.c @@ -683,8 +683,8 @@ int main(int argc, char **argv) free(extpath); } - scan_dir(UCLIBC_PREFIX "/usr/lib"); - scan_dir(UCLIBC_PREFIX "/lib"); + scan_dir(UCLIBC_TARGET_PREFIX "/usr/lib"); + scan_dir(UCLIBC_TARGET_PREFIX "/lib"); } if (!nocache) diff --git a/ldso/util/ldd.c b/ldso/util/ldd.c index fd0ff54b3..e8627fb0a 100644 --- a/ldso/util/ldd.c +++ b/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)) return 1; + /* We add libc.so.0 elsewhere */ + if (strcmp(s, UCLIBC_LDSO)==0) + return 1; + for (cur = lib_list; cur; cur=cur->next) { if(strcmp(cur->name, s)==0) { /* Lib is already in the list */ @@ -396,9 +400,13 @@ int main( int argc, char** argv) /* Print the list */ + got_em_all=0; for (cur = lib_list; cur; cur=cur->next) { + got_em_all=1; printf("\t%s => %s\n", cur->name, cur->path); } + if (got_em_all==0) + printf("\tnot a dynamic executable\n"); return 0; } diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c index ec5c988f5..eb6c4f4f6 100644 --- a/libc/unistd/getopt.c +++ b/libc/unistd/getopt.c @@ -39,10 +39,7 @@ int c; /* defective option letter */ return '?'; /* erroneous-option marker */ } -extern int getopt (int argc, char *const *argv, const char *optstring) - __attribute__ ((__weak__)); - -int getopt (int argc, char *const *argv, const char *optstring) +int __attribute__ ((__weak__)) getopt (int argc, char *const *argv, const char *optstring) { static int sp = 1; /* position within argument */ register int osp; /* saved `sp' for param test */ diff --git a/test/ctype/Makefile b/test/ctype/Makefile index b8b415c5d..ca689f33f 100644 --- a/test/ctype/Makefile +++ b/test/ctype/Makefile @@ -1,7 +1,7 @@ TESTDIR=../ include $(TESTDIR)/Rules.mak -TARGETS=ctype +TARGETS=ctype ctype_run all: $(TARGETS) 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) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ + +ctype_run: + ./ctype -@ echo " " clean: rm -f *.[oa] *~ core $(TARGETS) |