From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13769 invoked by alias); 18 Mar 2013 11:53:29 -0000 Received: (qmail 13748 invoked by uid 22791); 18 Mar 2013 11:53:25 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,TW_FN X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 Mar 2013 11:53:19 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EF898A520D; Mon, 18 Mar 2013 12:53:17 +0100 (CET) From: Andreas Schwab To: Marcus Shawcroft Cc: libc-alpha@sourceware.org, libc-ports@sourceware.org Subject: [PATCH] Add support for rtld directory different from slib directory References: X-Yow: I don't believe there really IS a GAS SHORTAGE.. I think it's all just a BIG HOAX on the part of the plastic sign salesmen-- .. to sell more numbers!! Date: Mon, 18 Mar 2013 11:53:00 -0000 In-Reply-To: (Marcus Shawcroft's message of "Fri, 15 Mar 2013 14:52:50 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00151.txt.bz2 Tested on aarch64 and x86. Andreas. * configure.in: Substitute libc_cv_slibdir. * configure: Regenerate. * config.make.in (rtlddir): Set from libc_cv_rtlddir. * Makeconfig (rtlddir, inst_rtlddir): New variables. (rtld-LDFLAGS): Use them with $(rtld-installed-name). * elf/Makefile (install-others, CFLAGS-interp.c) (ldso_install, common-ldd-rewrite): Likewise. ($(inst_rtlddir)/$(rtld-installed-name)): Renamed from $(inst_slibdir)/$(rtld-installed-name). * scripts/rellns-sh: Add -p option. * Makerules (make-shlib-link): Use rellns-sh to get relative name for source. * sysdeps/gnu/configure.in: Set libc_cv_rtldir for s390x. * sysdeps/gnu/configure: Regenerate. ChangeLog.aarch64: * sysdeps/unix/sysv/linux/aarch64/configure.in: Set libc_cv_rtlddir. * sysdeps/unix/sysv/linux/aarch64/configure: Regenerate. --- Makeconfig | 10 ++++++++-- Makerules | 4 ++-- config.make.in | 1 + configure | 2 ++ configure.in | 1 + elf/Makefile | 11 ++++++----- ports/sysdeps/unix/sysv/linux/aarch64/configure | 1 + ports/sysdeps/unix/sysv/linux/aarch64/configure.in | 1 + scripts/rellns-sh | 15 +++++++++++++-- sysdeps/gnu/configure | 9 +++++++-- sysdeps/gnu/configure.in | 9 +++++++-- 11 files changed, 49 insertions(+), 15 deletions(-) diff --git a/Makeconfig b/Makeconfig index 6c88918..70deb1e 100644 --- a/Makeconfig +++ b/Makeconfig @@ -151,12 +151,18 @@ libdir = $(exec_prefix)/lib endif inst_libdir = $(install_root)$(libdir) -# Where to install the shared library and dynamic linker. +# Where to install the shared library. ifndef slibdir slibdir = $(exec_prefix)/lib endif inst_slibdir = $(install_root)$(slibdir) +# Where to install the dynamic linker. +ifndef rtlddir +rtlddir = $(slibdir) +endif +inst_rtlddir = $(install_root)$(rtlddir) + # Prefix to put on files installed in $(libdir). For libraries `libNAME.a', # the prefix is spliced between `lib' and the name, so the linker switch # `-l$(libprefix)NAME' finds the library; for other files the prefix is @@ -441,7 +447,7 @@ endif endif ifeq (yes,$(build-shared)) ifndef rtld-LDFLAGS -rtld-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name) +rtld-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name) endif ifndef rtld-tests-LDFLAGS ifeq (yes,$(build-hardcoded-path-in-tests)) diff --git a/Makerules b/Makerules index b115f1a..4d191e0 100644 --- a/Makerules +++ b/Makerules @@ -864,7 +864,7 @@ ifeq (no,$(cross-compiling)) symbolic-link-prog := $(common-objpfx)elf/sln symbolic-link-list := $(common-objpfx)elf/symlink.list define make-shlib-link -echo $(> $(symbolic-link-list) +echo $(shell $(..)scripts/rellns-sh -p $< $@) $@ >> $(symbolic-link-list) endef else # cross-compiling # We need a definition that can be used by elf/Makefile's install rules. @@ -874,7 +874,7 @@ endif ifndef make-shlib-link define make-shlib-link rm -f $@ -$(LN_S) $(>confdefs.h diff --git a/configure.in b/configure.in index c578979..cb31730 100644 --- a/configure.in +++ b/configure.in @@ -2153,6 +2153,7 @@ fi AC_SUBST(old_glibc_headers) AC_SUBST(libc_cv_slibdir) +AC_SUBST(libc_cv_rtlddir) AC_SUBST(libc_cv_localedir) AC_SUBST(libc_cv_sysconfdir) AC_SUBST(libc_cv_localstatedir) diff --git a/elf/Makefile b/elf/Makefile index 6d4b365..9477a4d 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -66,7 +66,7 @@ endif ifeq (yes,$(build-shared)) extra-objs = $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os generated += librtld.os dl-allobjs.os ld.so ldd -install-others = $(inst_slibdir)/$(rtld-installed-name) +install-others = $(inst_rtlddir)/$(rtld-installed-name) install-bin-script = ldd endif @@ -340,7 +340,7 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map) | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }' # interp.c exists just to get this string into the libraries. -CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \ +CFLAGS-interp.c = -D'RUNTIME_LINKER="$(rtlddir)/$(rtld-installed-name)"' \ -DNOT_IN_libc=1 $(objpfx)interp.os: $(common-objpfx)config.make @@ -372,18 +372,19 @@ $(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force) $(make-target-directory) $(do-install-program) -$(inst_slibdir)/$(rtld-installed-name): \ +$(inst_rtlddir)/$(rtld-installed-name): \ $(inst_slibdir)/$(rtld-version-installed-name) \ $(inst_slibdir)/libc-$(version).so + $(make-target-directory) $(make-shlib-link) # Special target called by parent to install just the dynamic linker. .PHONY: ldso_install -ldso_install: $(inst_slibdir)/$(rtld-installed-name) +ldso_install: $(inst_rtlddir)/$(rtld-installed-name) endif -common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \ +common-ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \ -e 's%@VERSION@%$(version)%g' \ -e 's|@PKGVERSION@|$(PKGVERSION)|g' \ -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/configure b/ports/sysdeps/unix/sysv/linux/aarch64/configure index 04b6c81..6b2608a 100644 --- a/ports/sysdeps/unix/sysv/linux/aarch64/configure +++ b/ports/sysdeps/unix/sysv/linux/aarch64/configure @@ -7,6 +7,7 @@ test -n "$libc_cv_slibdir" || case "$prefix" in /usr | /usr/) libc_cv_slibdir="/lib64" + libc_cv_rtlddir="/lib" if test "$libdir" = '${exec_prefix}/lib'; then libdir='${exec_prefix}/lib64'; # Locale data can be shared between 32bit and 64bit libraries diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/configure.in b/ports/sysdeps/unix/sysv/linux/aarch64/configure.in index 6596a15..b090702 100644 --- a/ports/sysdeps/unix/sysv/linux/aarch64/configure.in +++ b/ports/sysdeps/unix/sysv/linux/aarch64/configure.in @@ -7,6 +7,7 @@ test -n "$libc_cv_slibdir" || case "$prefix" in /usr | /usr/) libc_cv_slibdir="/lib64" + libc_cv_rtlddir="/lib" if test "$libdir" = '${exec_prefix}/lib'; then libdir='${exec_prefix}/lib64'; # Locale data can be shared between 32bit and 64bit libraries diff --git a/scripts/rellns-sh b/scripts/rellns-sh index 0e861b5..94e7f00 100755 --- a/scripts/rellns-sh +++ b/scripts/rellns-sh @@ -16,8 +16,15 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, see . +do_print=false +case $1 in + -p) + do_print=true + shift + ;; +esac if test $# -ne 2; then - echo "Usage: rellns SOURCE DEST" >&2 + echo "Usage: rellns [-p] SOURCE DEST" >&2 exit 1 fi @@ -70,4 +77,8 @@ while test -n "$from"; do from=`echo $from | sed 's%^[^/]*/*%%'` done -ln -s $rfrom$to $2 +if $do_print; then + echo "$rfrom$to" +else + ln -s $rfrom$to $2 +fi diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure index 26327ca..70aaa90 100644 --- a/sysdeps/gnu/configure +++ b/sysdeps/gnu/configure @@ -9,12 +9,17 @@ case "$prefix" in /usr | /usr/) # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib. - # Allow earlier configure scripts to handle libc_cv_slibdir, libdir, - # and libc_cv_localedir. + # Allow earlier configure scripts to handle libc_cv_slibdir, + # libc_cv_rtlddir, libdir, and libc_cv_localedir. test -n "$libc_cv_slibdir" || \ case $machine in sparc/sparc64 | x86_64* | powerpc/powerpc64 | s390/s390-64) libc_cv_slibdir=/lib64 + case $machine in + s390/s390-64) + libc_cv_rtlddir=/lib + ;; + esac if test "$libdir" = '${exec_prefix}/lib'; then libdir='${exec_prefix}/lib64'; # Locale data can be shared between 32bit and 64bit libraries diff --git a/sysdeps/gnu/configure.in b/sysdeps/gnu/configure.in index b8fd74c..ce251df 100644 --- a/sysdeps/gnu/configure.in +++ b/sysdeps/gnu/configure.in @@ -9,12 +9,17 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. case "$prefix" in /usr | /usr/) # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib. - # Allow earlier configure scripts to handle libc_cv_slibdir, libdir, - # and libc_cv_localedir. + # Allow earlier configure scripts to handle libc_cv_slibdir, + # libc_cv_rtlddir, libdir, and libc_cv_localedir. test -n "$libc_cv_slibdir" || \ case $machine in sparc/sparc64 | x86_64* | powerpc/powerpc64 | s390/s390-64) libc_cv_slibdir=/lib64 + case $machine in + s390/s390-64) + libc_cv_rtlddir=/lib + ;; + esac if test "$libdir" = '${exec_prefix}/lib'; then libdir='${exec_prefix}/lib64'; # Locale data can be shared between 32bit and 64bit libraries -- 1.8.2 -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."