[openwrt/openwrt] scripts: bundle-libraries.sh: fix broken SDK compiler
LEDE Commits
lede-commits at lists.infradead.org
Mon Nov 2 02:40:07 EST 2020
ynezz pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/4b7165722cb0e2ba62ab68e8b90d4d4b0909744c
commit 4b7165722cb0e2ba62ab68e8b90d4d4b0909744c
Author: Petr Štetiar <ynezz at true.cz>
AuthorDate: Sun Nov 1 14:40:02 2020 +0100
scripts: bundle-libraries.sh: fix broken SDK compiler
Recent versions (> 5.33) of `file` report liblto_plugin.so as
executable:
$ file liblto_plugin.so
liblto_plugin.so.0.0.0: ELF 64-bit LSB pie executable ...
Which then leads to improper packaging of the plugin, resulting in the
broken compiler:
configure: checking whether the C compiler works
mips-openwrt-linux-musl/bin/ld: liblto_plugin.so: error loading plugin: liblto_plugin.so: invalid ELF header
As the LTO compiler plugin library is incorrectly packaged as SDK
executable:
$ head -1 ~/staging_dir/toolchain...libexec/gcc/.../liblto_plugin.so
#!/usr/bin/env bash
Fix this by filtering out shared libraries from the patching.
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1296868
Acked-by: Jo-Philipp Wich <jo at mein.io>
Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
scripts/bundle-libraries.sh | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/scripts/bundle-libraries.sh b/scripts/bundle-libraries.sh
index 9efcbbd0b2..621bf579e7 100755
--- a/scripts/bundle-libraries.sh
+++ b/scripts/bundle-libraries.sh
@@ -125,6 +125,23 @@ _patch_glibc() {
fi
}
+should_be_patched() {
+ local bin="$1"
+
+ [ -x "$bin" ] || return 1
+
+ case "$bin" in
+ *.so|*.so.[0-9]*)
+ return 1
+ ;;
+ *)
+ file "$bin" | grep -sqE "ELF.*(executable|interpreter)" && return 0
+ ;;
+ esac
+
+ return 1
+}
+
for LDD in ${PATH//://ldd }/ldd; do
"$LDD" --version >/dev/null 2>/dev/null && break
LDD=""
@@ -150,7 +167,7 @@ for BIN in "$@"; do
LDSO=""
- [ -n "$LDD" ] && [ -x "$BIN" ] && file "$BIN" | grep -sqE "ELF.*(executable|interpreter)" && {
+ [ -n "$LDD" ] && should_be_patched "$BIN" && {
for token in $("$LDD" "$BIN" 2>/dev/null); do
case "$token" in */*.so*)
dest="$DIR/lib/${token##*/}"
More information about the lede-commits
mailing list