blob: 8b097f32768b2711e480d19baf28a580d2f065a0 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001From f95b6fd0475a95c00e886219271cb5c93838e3c3 Mon Sep 17 00:00:00 2001
Brad Bishop6e60e8b2018-02-01 10:27:11 -05002From: Amarnath Valluri <amarnath.valluri@intel.com>
3Date: Wed, 18 Jan 2017 16:14:37 +0200
Patrick Williams92b42cb2022-09-03 06:53:57 -05004Subject: [PATCH 1/2] Make dynamic linker a relative symlink to libc
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05005
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
Brad Bishop6e60e8b2018-02-01 10:27:11 -050012V2:
13 Make use of 'ln -r' to create relative symlinks, as most fo the distros
14 shipping coreutils 8.16+
15
Patrick Williams92b42cb2022-09-03 06:53:57 -050016Upstream-Status: Pending
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050017Signed-off-by: Khem Raj <raj.khem@gmail.com>
Brad Bishop6e60e8b2018-02-01 10:27:11 -050018Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050019---
Brad Bishop6e60e8b2018-02-01 10:27:11 -050020 Makefile | 2 +-
21 tools/install.sh | 8 +++++---
22 2 files changed, 6 insertions(+), 4 deletions(-)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050023
Patrick Williams92b42cb2022-09-03 06:53:57 -050024diff --git a/Makefile b/Makefile
25index e8cc4436..466d9afd 100644
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050026--- a/Makefile
27+++ b/Makefile
Patrick Williams92b42cb2022-09-03 06:53:57 -050028@@ -210,7 +210,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/include/%
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050029 $(INSTALL) -D -m 644 $< $@
30
31 $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
32- $(INSTALL) -D -l $(libdir)/libc.so $@ || true
Brad Bishop6e60e8b2018-02-01 10:27:11 -050033+ $(INSTALL) -D -r $(DESTDIR)$(libdir)/libc.so $@ || true
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050034
35 install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
36
Patrick Williams92b42cb2022-09-03 06:53:57 -050037diff --git a/tools/install.sh b/tools/install.sh
38index d913b60b..b6a7f797 100755
Brad Bishop6e60e8b2018-02-01 10:27:11 -050039--- 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
Patrick Williams92b42cb2022-09-03 06:53:57 -050064@@ -48,7 +50,7 @@ trap 'rm -f "$tmp"' EXIT INT QUIT TERM HUP
Brad Bishop6e60e8b2018-02-01 10:27:11 -050065 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"
Patrick Williams92b42cb2022-09-03 06:53:57 -050073--
742.37.2
75