Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 1 | From f95b6fd0475a95c00e886219271cb5c93838e3c3 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 2 | From: Amarnath Valluri <amarnath.valluri@intel.com> |
| 3 | Date: Wed, 18 Jan 2017 16:14:37 +0200 |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 4 | Subject: [PATCH 1/2] Make dynamic linker a relative symlink to libc |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 5 | |
| 6 | absolute symlink into $(libdir) fails to load in a cross build |
| 7 | environment, especially when executing qemu in usermode to run target |
| 8 | applications, which cross build systems often do, since not everything |
| 9 | can be computed during cross builds, qemu in usermode often comes to aid |
| 10 | in such situations to feed into cross builds. |
| 11 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 12 | V2: |
| 13 | Make use of 'ln -r' to create relative symlinks, as most fo the distros |
| 14 | shipping coreutils 8.16+ |
| 15 | |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 16 | Upstream-Status: Pending |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 18 | Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 19 | --- |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 20 | Makefile | 2 +- |
| 21 | tools/install.sh | 8 +++++--- |
| 22 | 2 files changed, 6 insertions(+), 4 deletions(-) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 23 | |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 24 | diff --git a/Makefile b/Makefile |
| 25 | index e8cc4436..466d9afd 100644 |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 26 | --- a/Makefile |
| 27 | +++ b/Makefile |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 28 | @@ -210,7 +210,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/include/% |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 29 | $(INSTALL) -D -m 644 $< $@ |
| 30 | |
| 31 | $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so |
| 32 | - $(INSTALL) -D -l $(libdir)/libc.so $@ || true |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 33 | + $(INSTALL) -D -r $(DESTDIR)$(libdir)/libc.so $@ || true |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 34 | |
| 35 | install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),) |
| 36 | |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 37 | diff --git a/tools/install.sh b/tools/install.sh |
| 38 | index d913b60b..b6a7f797 100755 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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 |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 64 | @@ -48,7 +50,7 @@ trap 'rm -f "$tmp"' EXIT INT QUIT TERM HUP |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 73 | -- |
| 74 | 2.37.2 |
| 75 | |