From patchwork Sun Nov 1 14:16:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1391747 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=205.233.59.134; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=ex9WN8UD; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CPJ7h581Zz9sSf for ; Mon, 2 Nov 2020 01:18:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=UeKyxWYaKGzXQmBnbN50AMxgwiWwfWavRLUrv5cZhFc=; b=ex9WN8UDHQU8l4KTHvJvOEAuEL n4bxKD6SDYyxQfKYqiUABYMb7JdeUtp/WJHj2DLBvTXxRmlt1XvLHWygkcLKhCKJXPIPWXoJ/EV2p OBEsYrSbykyslOIAgRvjyJ+bXIdKaceLJPcjv0nH3m7meG6z77ncfOOYVtwKhxT/fio1/ygescLUY KRJazxkI71BIGafhxSI+RpbWTCthshLjmf2kM6Cf3U63sCW7+cq3bw8c7xXecdd50LCDh0l2Br5NZ Slk36gcwXWAHwDKypNYsgicgzk2NVcKOq7YG6o7hVxB0QHAep/+xTesoQ/AM1aTlbQU95OrtQvB44 YBNxNeug==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZE9r-0007Hy-CA; Sun, 01 Nov 2020 14:16:35 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZE9T-0007H6-3R for openwrt-devel@lists.openwrt.org; Sun, 01 Nov 2020 14:16:12 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 0532D3B72; Sun, 1 Nov 2020 15:16:07 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id c377c701; Sun, 1 Nov 2020 15:15:49 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Subject: [PATCH] scripts: bundle-libraries.sh: fix broken SDK compiler Date: Sun, 1 Nov 2020 15:16:02 +0100 Message-Id: <20201101141602.32650-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201101_091611_264012_07FBCCA6 X-CRM114-Status: GOOD ( 16.78 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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 --- 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*)