[PATCH] scripts: bundle-libraries.sh: fix broken SDK compiler
Petr Štetiar
ynezz at true.cz
Sun Nov 1 09:16:02 EST 2020
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:
...
Bundling liblto_plugin.so.0.0.0
...
$ head -1 ~/staging_dir/toolchain...libexec/gcc/.../liblto_plugin.so
#!/usr/bin/env bash
Fix this by removing executable bit from shared libraries before the
bundling as it seems, that this is enough for `file` to detect it
properly again as shared library:
$ chmod -x liblto_plugin.so
$ file liblto_plugin.so
liblto_plugin.so: ELF 64-bit LSB shared object ...
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1296868
Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
scripts/bundle-libraries.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/bundle-libraries.sh b/scripts/bundle-libraries.sh
index 9efcbbd0b20e..70a88e685ac7 100755
--- a/scripts/bundle-libraries.sh
+++ b/scripts/bundle-libraries.sh
@@ -150,6 +150,7 @@ for BIN in "$@"; do
LDSO=""
+ [[ "$BIN" =~ \.so[\.0-9]*$ ]] && chmod -x "$BIN"
[ -n "$LDD" ] && [ -x "$BIN" ] && file "$BIN" | grep -sqE "ELF.*(executable|interpreter)" && {
for token in $("$LDD" "$BIN" 2>/dev/null); do
case "$token" in */*.so*)
More information about the openwrt-devel
mailing list