1From f95b6fd0475a95c00e886219271cb5c93838e3c3 Mon Sep 17 00:00:00 2001 2From: Amarnath Valluri <amarnath.valluri@intel.com> 3Date: Wed, 18 Jan 2017 16:14:37 +0200 4Subject: [PATCH 1/2] Make dynamic linker a relative symlink to libc 5 6absolute symlink into $(libdir) fails to load in a cross build 7environment, especially when executing qemu in usermode to run target 8applications, which cross build systems often do, since not everything 9can be computed during cross builds, qemu in usermode often comes to aid 10in such situations to feed into cross builds. 11 12V2: 13 Make use of 'ln -r' to create relative symlinks, as most fo the distros 14 shipping coreutils 8.16+ 15 16Upstream-Status: Pending 17Signed-off-by: Khem Raj <raj.khem@gmail.com> 18Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com> 19--- 20 Makefile | 2 +- 21 tools/install.sh | 8 +++++--- 22 2 files changed, 6 insertions(+), 4 deletions(-) 23 24diff --git a/Makefile b/Makefile 25index e8cc4436..466d9afd 100644 26--- a/Makefile 27+++ b/Makefile 28@@ -210,7 +210,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/include/% 29 $(INSTALL) -D -m 644 $< $@ 30 31 $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so 32- $(INSTALL) -D -l $(libdir)/libc.so $@ || true 33+ $(INSTALL) -D -r $(DESTDIR)$(libdir)/libc.so $@ || true 34 35 install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),) 36 37diff --git a/tools/install.sh b/tools/install.sh 38index d913b60b..b6a7f797 100755 39--- a/tools/install.sh 40+++ b/tools/install.sh 41@@ -6,18 +6,20 @@ 42 # 43 44 usage() { 45-printf "usage: %s [-D] [-l] [-m mode] src dest\n" "$0" 1>&2 46+printf "usage: %s [-D] [-l] [-r] [-m mode] src dest\n" "$0" 1>&2 47 exit 1 48 } 49 50 mkdirp= 51 symlink= 52+symlinkflags="-s" 53 mode=755 54 55-while getopts Dlm: name ; do 56+while getopts Dlrm: name ; do 57 case "$name" in 58 D) mkdirp=yes ;; 59 l) symlink=yes ;; 60+r) symlink=yes; symlinkflags="$symlinkflags -r" ;; 61 m) mode=$OPTARG ;; 62 ?) usage ;; 63 esac 64@@ -48,7 +50,7 @@ trap 'rm -f "$tmp"' EXIT INT QUIT TERM HUP 65 umask 077 66 67 if test "$symlink" ; then 68-ln -s "$1" "$tmp" 69+ln $symlinkflags "$1" "$tmp" 70 else 71 cat < "$1" > "$tmp" 72 chmod "$mode" "$tmp" 73-- 742.37.2 75 76