diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2023-03-15 15:38:44 +0000 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2023-03-16 21:28:38 +0000 |
commit | 8e985a14019529314bd6c5ebd9793d84e23904ce (patch) | |
tree | bafb43ae1d5a1c27f839bad4cd82f91afb533ce8 | |
parent | 83149cd5a4028ba9debe1d917df43990563021f3 (diff) |
lib/make.sh: (find_dynamic_linker) Handle case where RTLDLIST is really a list
As the name implies, glibc's RTLDLIST defined in the ldd script can
contain a list of supported dynamic linker names, but we only support
the case where the list contains a single element.
However, for instance on x86_64, we have:
RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2"
so this patch iterates until it finds the dynamic linker binary file.
We only take into account the basename, since for instance we
currently find ld-linux-x86-64.so.2 under /lib.
This patch fixes the build of native x86_64 toolchains.
Change-Id: I36ceb83f2dd8d6f0df1fc27e2eee653ef1592898
-rw-r--r-- | lib/make.sh | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/make.sh b/lib/make.sh index 3e53a846..cc43e7e5 100644 --- a/lib/make.sh +++ b/lib/make.sh @@ -486,6 +486,7 @@ find_dynamic_linker() { local strict="$1" local dynamic_linker c_library_version + local dynamic_linkers tmp_dynamic_linker # Programmatically determine the embedded glibc version number for # this version of the clibrary. @@ -493,9 +494,18 @@ find_dynamic_linker() c_library_version="$(${sysroots}/libc/usr/bin/ldd --version | head -n 1 | sed -e "s/.* //")" dynamic_linker="$(find ${sysroots}/libc -type f -name ld-${c_library_version}.so)" if [ x"$dynamic_linker" = x"" ]; then - dynamic_linker=$(grep "^RTLDLIST=" "$sysroots/libc/usr/bin/ldd" \ - | sed -e "s/^RTLDLIST=//") - dynamic_linker="$sysroots/libc/$dynamic_linker" + dynamic_linkers=$(grep "^RTLDLIST=" "$sysroots/libc/usr/bin/ldd" \ + | sed -e "s/^RTLDLIST=//" -e 's/^"\(.*\)"$/\1/g') + for tmp_dynamic_linker in $dynamic_linkers; do + tmp_dynamic_linker="$(find $sysroots/libc -name "$(basename $tmp_dynamic_linker)")" + if [ -f "$tmp_dynamic_linker" ]; then + if [ "$dynamic_linker" != "" ]; then + error "Found more than one dynamic linker: $dynamic_linker $tmp_dynamic_linker" + return 1 + fi + dynamic_linker="$tmp_dynamic_linker" + fi + done fi fi if $strict && [ -z "$dynamic_linker" ]; then |