ce426f
#
ce426f
# All patches are from upstream and provide support for correct lib
ce426f
# directory for AArch64.
ce426f
#
ce426f
# From 37bf2f1f983e37c0d87a1e34cd3d8a228ead5e16 Mon Sep 17 00:00:00 2001
ce426f
# From: Andreas Schwab <schwab@suse.de>
ce426f
# Date: Thu, 4 Apr 2013 12:22:22 -0400
ce426f
# Subject: [PATCH 2/4] Add support for rtld directory different from slib
ce426f
#  directory
ce426f
# 
ce426f
# ---
ce426f
#  ChangeLog         | 15 +++++++++++++++
ce426f
#  Makeconfig        | 10 ++++++++--
ce426f
#  Makerules         |  4 ++--
ce426f
#  config.make.in    |  1 +
ce426f
#  configure         |  2 ++
ce426f
#  configure.in      |  1 +
ce426f
#  elf/Makefile      | 11 ++++++-----
ce426f
#  scripts/rellns-sh | 17 +++++++++++++++--
ce426f
#  8 files changed, 50 insertions(+), 11 deletions(-)
ce426f
# 
ce426f
# From 937dd2d4a5da7d51b87261b037e22dfca05face7 Mon Sep 17 00:00:00 2001
ce426f
# From: Marcus Shawcroft <marcus.shawcroft@linaro.org>
ce426f
# Date: Thu, 4 Apr 2013 12:26:55 -0400
ce426f
# Subject: [PATCH 4/4] Correct missed use of $(rtlddir).
ce426f
# 
ce426f
# ---
ce426f
#  ChangeLog | 4 ++++
ce426f
#  Makerules | 2 +-
ce426f
#  2 files changed, 5 insertions(+), 1 deletion(-)
ce426f
# 
ce426f
# From bcce68c6dc678b443e7f140d664ba1fa49c0ceaa Mon Sep 17 00:00:00 2001
ce426f
# From: Andreas Schwab <schwab@suse.de>
ce426f
# Date: Thu, 4 Apr 2013 12:23:43 -0400
ce426f
# Subject: [PATCH 3/4] aarch64: Move rtld link to /lib
ce426f
# 
ce426f
# ---
ce426f
#  ports/ChangeLog.aarch64                            | 6 ++++++
ce426f
#  ports/sysdeps/unix/sysv/linux/aarch64/configure    | 1 +
ce426f
#  ports/sysdeps/unix/sysv/linux/aarch64/configure.in | 1 +
ce426f
#  3 files changed, 8 insertions(+)
ce426f
# 
ce426f
# From 05bc48a20b8c20574bc59a048750f0dd77fd6e23 Mon Sep 17 00:00:00 2001
ce426f
# From: Andreas Schwab <schwab@suse.de>
ce426f
# Date: Thu, 4 Apr 2013 12:02:53 -0400
ce426f
# Subject: [PATCH 1/4] aarch64: use lib64 as default lib and slib directory
ce426f
# 
ce426f
# ---
ce426f
#  ports/ChangeLog.aarch64                            |  6 ++++++
ce426f
#  ports/sysdeps/unix/sysv/linux/aarch64/configure    | 13 +++++++++++++
ce426f
#  ports/sysdeps/unix/sysv/linux/aarch64/configure.in | 12 ++++++++++++
ce426f
#  3 files changed, 31 insertions(+)
ce426f
# 
ce426f
# commit 446737706c186b33529a2c07fcb6f0cc10b2d1ea
ce426f
# Author: Andreas Schwab <schwab@suse.de>
ce426f
# Date:   Tue Mar 19 10:13:46 2013 +0100
ce426f
#
ce426f
#    s390x: Move rtld link to /lib
ce426f
#
ce426f
diff -urN glibc-2.17-c758a686/config.make.in glibc-2.17-c758a686/config.make.in
ce426f
--- glibc-2.17-c758a686/config.make.in	2013-10-28 10:56:39.996320904 -0400
ce426f
+++ glibc-2.17-c758a686/config.make.in	2013-10-28 10:56:57.773317467 -0400
ce426f
@@ -11,6 +11,7 @@
ce426f
 datadir = @datadir@
ce426f
 libdir = @libdir@
ce426f
 slibdir = @libc_cv_slibdir@
ce426f
+rtlddir = @libc_cv_rtlddir@
ce426f
 localedir = @libc_cv_localedir@
ce426f
 sysconfdir = @libc_cv_sysconfdir@
ce426f
 libexecdir = @libexecdir@
ce426f
diff -urN glibc-2.17-c758a686/configure glibc-2.17-c758a686/configure
ce426f
--- glibc-2.17-c758a686/configure	2013-10-28 10:56:39.935320916 -0400
ce426f
+++ glibc-2.17-c758a686/configure	2013-10-28 10:56:57.775317467 -0400
ce426f
@@ -594,6 +594,7 @@
ce426f
 libc_cv_localstatedir
ce426f
 libc_cv_sysconfdir
ce426f
 libc_cv_localedir
ce426f
+libc_cv_rtlddir
ce426f
 libc_cv_slibdir
ce426f
 old_glibc_headers
ce426f
 use_nscd
ce426f
@@ -7600,6 +7601,7 @@
ce426f
 
ce426f
 
ce426f
 
ce426f
+
ce426f
 
ce426f
 
ce426f
 
ce426f
diff -urN glibc-2.17-c758a686/configure.in glibc-2.17-c758a686/configure.in
ce426f
--- glibc-2.17-c758a686/configure.in	2013-10-28 10:56:39.902320923 -0400
ce426f
+++ glibc-2.17-c758a686/configure.in	2013-10-28 10:56:57.776317467 -0400
ce426f
@@ -2127,6 +2127,7 @@
ce426f
 AC_SUBST(old_glibc_headers)
ce426f
 
ce426f
 AC_SUBST(libc_cv_slibdir)
ce426f
+AC_SUBST(libc_cv_rtlddir)
ce426f
 AC_SUBST(libc_cv_localedir)
ce426f
 AC_SUBST(libc_cv_sysconfdir)
ce426f
 AC_SUBST(libc_cv_localstatedir)
ce426f
diff -urN glibc-2.17-c758a686/elf/Makefile glibc-2.17-c758a686/elf/Makefile
ce426f
--- glibc-2.17-c758a686/elf/Makefile	2013-10-28 10:56:40.127320879 -0400
ce426f
+++ glibc-2.17-c758a686/elf/Makefile	2013-10-28 10:56:57.776317467 -0400
ce426f
@@ -66,7 +66,7 @@
ce426f
 ifeq (yes,$(build-shared))
ce426f
 extra-objs	= $(all-rtld-routines:%=%.os) soinit.os sofini.os interp.os
ce426f
 generated	+= librtld.os dl-allobjs.os ld.so ldd
ce426f
-install-others	= $(inst_slibdir)/$(rtld-installed-name)
ce426f
+install-others = $(inst_rtlddir)/$(rtld-installed-name)
ce426f
 install-bin-script = ldd
ce426f
 endif
ce426f
 
ce426f
@@ -341,7 +341,7 @@
ce426f
 	  | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
ce426f
 
ce426f
 # interp.c exists just to get this string into the libraries.
ce426f
-CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"' \
ce426f
+CFLAGS-interp.c = -D'RUNTIME_LINKER="$(rtlddir)/$(rtld-installed-name)"' \
ce426f
 		  -DNOT_IN_libc=1
ce426f
 $(objpfx)interp.os: $(common-objpfx)config.make
ce426f
 
ce426f
@@ -373,18 +373,19 @@
ce426f
 	$(make-target-directory)
ce426f
 	$(do-install-program)
ce426f
 
ce426f
-$(inst_slibdir)/$(rtld-installed-name): \
ce426f
+$(inst_rtlddir)/$(rtld-installed-name): \
ce426f
   $(inst_slibdir)/$(rtld-version-installed-name) \
ce426f
   $(inst_slibdir)/libc-$(version).so
ce426f
+	$(make-target-directory)
ce426f
 	$(make-shlib-link)
ce426f
 
ce426f
 # Special target called by parent to install just the dynamic linker.
ce426f
 .PHONY: ldso_install
ce426f
-ldso_install: $(inst_slibdir)/$(rtld-installed-name)
ce426f
+ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
ce426f
 endif
ce426f
 
ce426f
 
ce426f
-common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
ce426f
+common-ldd-rewrite = -e 's%@RTLD@%$(rtlddir)/$(rtld-installed-name)%g' \
ce426f
 		     -e 's%@VERSION@%$(version)%g' \
ce426f
 		     -e 's|@PKGVERSION@|$(PKGVERSION)|g' \
ce426f
 		     -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g'
ce426f
diff -urN glibc-2.17-c758a686/Makeconfig glibc-2.17-c758a686/Makeconfig
ce426f
--- glibc-2.17-c758a686/Makeconfig	2013-10-28 10:56:40.434320820 -0400
ce426f
+++ glibc-2.17-c758a686/Makeconfig	2013-10-28 10:56:57.772317467 -0400
ce426f
@@ -148,12 +148,18 @@
ce426f
 endif
ce426f
 inst_libdir = $(install_root)$(libdir)
ce426f
 
ce426f
-# Where to install the shared library and dynamic linker.
ce426f
+# Where to install the shared library.
ce426f
 ifndef slibdir
ce426f
 slibdir = $(exec_prefix)/lib
ce426f
 endif
ce426f
 inst_slibdir = $(install_root)$(slibdir)
ce426f
 
ce426f
+# Where to install the dynamic linker.
ce426f
+ifndef rtlddir
ce426f
+rtlddir = $(slibdir)
ce426f
+endif
ce426f
+inst_rtlddir = $(install_root)$(rtlddir)
ce426f
+
ce426f
 # Prefix to put on files installed in $(libdir).  For libraries `libNAME.a',
ce426f
 # the prefix is spliced between `lib' and the name, so the linker switch
ce426f
 # `-l$(libprefix)NAME' finds the library; for other files the prefix is
ce426f
@@ -443,7 +449,7 @@
ce426f
 endif
ce426f
 ifndef config-LDFLAGS
ce426f
 ifeq (yes,$(build-shared))
ce426f
-config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
ce426f
+config-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name)
ce426f
 endif
ce426f
 endif
ce426f
 ifndef link-libc
ce426f
diff -urN glibc-2.17-c758a686/Makerules glibc-2.17-c758a686/Makerules
ce426f
--- glibc-2.17-c758a686/Makerules	2013-10-28 10:56:39.928320918 -0400
ce426f
+++ glibc-2.17-c758a686/Makerules	2013-10-28 10:56:57.777317467 -0400
ce426f
@@ -873,7 +873,7 @@
ce426f
 symbolic-link-prog := $(common-objpfx)elf/sln
ce426f
 symbolic-link-list := $(common-objpfx)elf/symlink.list
ce426f
 define make-shlib-link
ce426f
-echo $(<F) $@ >> $(symbolic-link-list)
ce426f
+echo `$(..)scripts/rellns-sh -p $< $@` $@ >> $(symbolic-link-list)
ce426f
 endef
ce426f
 else # cross-compiling
ce426f
 # We need a definition that can be used by elf/Makefile's install rules.
ce426f
@@ -883,7 +883,7 @@
ce426f
 ifndef make-shlib-link
ce426f
 define make-shlib-link
ce426f
 rm -f $@
ce426f
-$(LN_S) $(
ce426f
+$(LN_S) `$(..)scripts/rellns-sh -p $< $@` $@
ce426f
 endef
ce426f
 endif
ce426f
 
ce426f
@@ -937,7 +937,7 @@
ce426f
 	 cat $<; \
ce426f
 	 echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
ce426f
 	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
ce426f
-	      ' AS_NEEDED (' $(slibdir)/$(rtld-installed-name) ') )' \
ce426f
+	      ' AS_NEEDED (' $(rtlddir)/$(rtld-installed-name) ') )' \
ce426f
 	) > $@.new
ce426f
 	mv -f $@.new $@
ce426f
 
ce426f
diff -urN glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/configure glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/configure
ce426f
--- glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/configure	2013-10-28 10:56:39.873320928 -0400
ce426f
+++ glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/configure	2013-10-28 10:57:26.270311964 -0400
ce426f
@@ -1,3 +1,17 @@
ce426f
 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
ce426f
+ # Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
ce426f
 
ce426f
 arch_minimum_kernel=3.7.0
ce426f
+
ce426f
+test -n "$libc_cv_slibdir" ||
ce426f
+case "$prefix" in
ce426f
+  /usr | /usr/)
ce426f
+    libc_cv_slibdir="/lib64"
ce426f
+    libc_cv_rtlddir="/lib"
ce426f
+    if test "$libdir" = '${exec_prefix}/lib'; then
ce426f
+      libdir='${exec_prefix}/lib64';
ce426f
+      # Locale data can be shared between 32bit and 64bit libraries
ce426f
+      libc_cv_localedir='${exec_prefix}/lib/locale'
ce426f
+    fi
ce426f
+    ;;
ce426f
+esac
ce426f
diff -urN glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/configure.in glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/configure.in
ce426f
--- glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/configure.in	2013-10-28 10:56:39.873320928 -0400
ce426f
+++ glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/configure.in	2013-10-28 10:57:49.162307556 -0400
ce426f
@@ -2,3 +2,16 @@
ce426f
 # Local configure fragment for sysdeps/unix/sysv/linux/aarch64.
ce426f
 
ce426f
 arch_minimum_kernel=3.7.0
ce426f
+
ce426f
+test -n "$libc_cv_slibdir" ||
ce426f
+case "$prefix" in
ce426f
+  /usr | /usr/)
ce426f
+    libc_cv_slibdir="/lib64"
ce426f
+    libc_cv_rtlddir="/lib"
ce426f
+    if test "$libdir" = '${exec_prefix}/lib'; then
ce426f
+      libdir='${exec_prefix}/lib64';
ce426f
+      # Locale data can be shared between 32bit and 64bit libraries
ce426f
+      libc_cv_localedir='${exec_prefix}/lib/locale'
ce426f
+    fi
ce426f
+    ;;
ce426f
+esac
ce426f
diff -urN glibc-2.17-c758a686/scripts/rellns-sh glibc-2.17-c758a686/scripts/rellns-sh
ce426f
--- glibc-2.17-c758a686/scripts/rellns-sh	2013-10-28 10:56:40.081320888 -0400
ce426f
+++ glibc-2.17-c758a686/scripts/rellns-sh	2013-10-28 10:56:57.776317467 -0400
ce426f
@@ -16,8 +16,17 @@
ce426f
 # You should have received a copy of the GNU General Public License
ce426f
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
ce426f
 
ce426f
+# With -p, instead of creating the link print the computed relative link
ce426f
+# name.
ce426f
+do_print=false
ce426f
+case $1 in
ce426f
+  -p)
ce426f
+    do_print=true
ce426f
+    shift
ce426f
+    ;;
ce426f
+esac
ce426f
 if test $# -ne 2; then
ce426f
-  echo "Usage: rellns SOURCE DEST" >&2
ce426f
+  echo "Usage: rellns [-p] SOURCE DEST" >&2
ce426f
   exit 1
ce426f
 fi
ce426f
 
ce426f
@@ -70,4 +79,8 @@
ce426f
   from=`echo $from | sed 's%^[^/]*/*%%'`
ce426f
 done
ce426f
 
ce426f
-ln -s $rfrom$to $2
ce426f
+if $do_print; then
ce426f
+  echo "$rfrom$to"
ce426f
+else
ce426f
+  ln -s $rfrom$to $2
ce426f
+fi
ce426f
diff --git glibc-2.17-c758a686/sysdeps/gnu/configure glibc-2.17-c758a686/sysdeps/gnu/configure
ce426f
index 26327ca..70aaa90 100644
ce426f
--- glibc-2.17-c758a686/sysdeps/gnu/configure
ce426f
+++ glibc-2.17-c758a686/sysdeps/gnu/configure
ce426f
@@ -9,12 +9,17 @@
ce426f
 case "$prefix" in
ce426f
 /usr | /usr/)
ce426f
   # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
ce426f
-  # Allow earlier configure scripts to handle libc_cv_slibdir, libdir,
ce426f
-  # and libc_cv_localedir.
ce426f
+  # Allow earlier configure scripts to handle libc_cv_slibdir,
ce426f
+  # libc_cv_rtlddir, libdir, and libc_cv_localedir.
ce426f
   test -n "$libc_cv_slibdir" || \
ce426f
   case $machine in
ce426f
   sparc/sparc64 | x86_64* | powerpc/powerpc64 | s390/s390-64)
ce426f
     libc_cv_slibdir=/lib64
ce426f
+    case $machine in
ce426f
+    s390/s390-64)
ce426f
+      libc_cv_rtlddir=/lib
ce426f
+      ;;
ce426f
+    esac
ce426f
     if test "$libdir" = '${exec_prefix}/lib'; then
ce426f
       libdir='${exec_prefix}/lib64';
ce426f
       # Locale data can be shared between 32bit and 64bit libraries
ce426f
diff --git glibc-2.17-c758a686/sysdeps/gnu/configure.in glibc-2.17-c758a686/sysdeps/gnu/configure.in
ce426f
index b8fd74c..ce251df 100644
ce426f
--- glibc-2.17-c758a686/sysdeps/gnu/configure.in
ce426f
+++ glibc-2.17-c758a686/sysdeps/gnu/configure.in
ce426f
@@ -9,12 +9,17 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
ce426f
 case "$prefix" in
ce426f
 /usr | /usr/)
ce426f
   # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
ce426f
-  # Allow earlier configure scripts to handle libc_cv_slibdir, libdir,
ce426f
-  # and libc_cv_localedir.
ce426f
+  # Allow earlier configure scripts to handle libc_cv_slibdir,
ce426f
+  # libc_cv_rtlddir, libdir, and libc_cv_localedir.
ce426f
   test -n "$libc_cv_slibdir" || \
ce426f
   case $machine in
ce426f
   sparc/sparc64 | x86_64* | powerpc/powerpc64 | s390/s390-64)
ce426f
     libc_cv_slibdir=/lib64
ce426f
+    case $machine in
ce426f
+    s390/s390-64)
ce426f
+      libc_cv_rtlddir=/lib
ce426f
+      ;;
ce426f
+    esac
ce426f
     if test "$libdir" = '${exec_prefix}/lib'; then
ce426f
       libdir='${exec_prefix}/lib64';
ce426f
       # Locale data can be shared between 32bit and 64bit libraries