blob: ba00efe7b375adf7f6e7a693bf6e04c74dcfae02 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001From 0ec74744a4cba7c5fdfaa2685995119a4fca0260 Mon Sep 17 00:00:00 2001
2From: Amarnath Valluri <amarnath.valluri@intel.com>
3Date: Wed, 18 Jan 2017 16:14:37 +0200
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05004Subject: [PATCH] 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
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 Williamsd8c66bc2016-06-20 12:57:21 -050016Signed-off-by: Khem Raj <raj.khem@gmail.com>
Brad Bishop6e60e8b2018-02-01 10:27:11 -050017Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050018---
19Upstream-Status: Pending
Brad Bishop6e60e8b2018-02-01 10:27:11 -050020---
21 Makefile | 2 +-
22 tools/install.sh | 8 +++++---
23 2 files changed, 6 insertions(+), 4 deletions(-)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050024
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050025--- a/Makefile
26+++ b/Makefile
Andrew Geissler475cb722020-07-10 16:00:51 -050027@@ -210,7 +210,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050028 $(INSTALL) -D -m 644 $< $@
29
30 $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
31- $(INSTALL) -D -l $(libdir)/libc.so $@ || true
Brad Bishop6e60e8b2018-02-01 10:27:11 -050032+ $(INSTALL) -D -r $(DESTDIR)$(libdir)/libc.so $@ || true
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050033
34 install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
35
Brad Bishop6e60e8b2018-02-01 10:27:11 -050036--- a/tools/install.sh
37+++ b/tools/install.sh
38@@ -6,18 +6,20 @@
39 #
40
41 usage() {
42-printf "usage: %s [-D] [-l] [-m mode] src dest\n" "$0" 1>&2
43+printf "usage: %s [-D] [-l] [-r] [-m mode] src dest\n" "$0" 1>&2
44 exit 1
45 }
46
47 mkdirp=
48 symlink=
49+symlinkflags="-s"
50 mode=755
51
52-while getopts Dlm: name ; do
53+while getopts Dlrm: name ; do
54 case "$name" in
55 D) mkdirp=yes ;;
56 l) symlink=yes ;;
57+r) symlink=yes; symlinkflags="$symlinkflags -r" ;;
58 m) mode=$OPTARG ;;
59 ?) usage ;;
60 esac
Andrew Geissler475cb722020-07-10 16:00:51 -050061@@ -48,7 +50,7 @@ trap 'rm -f "$tmp"' EXIT INT QUIT TERM H
Brad Bishop6e60e8b2018-02-01 10:27:11 -050062 umask 077
63
64 if test "$symlink" ; then
65-ln -s "$1" "$tmp"
66+ln $symlinkflags "$1" "$tmp"
67 else
68 cat < "$1" > "$tmp"
69 chmod "$mode" "$tmp"