From patchwork Fri May 19 10:47:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 100184 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp248113qge; Fri, 19 May 2017 03:47:54 -0700 (PDT) X-Received: by 10.99.177.8 with SMTP id r8mr9478370pgf.109.1495190874495; Fri, 19 May 2017 03:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495190874; cv=none; d=google.com; s=arc-20160816; b=NPQMQPYGogLLtLvrC5ErbBblzgn7CmhKT24ZIqnmmOVldZZGKOkkTY4PnAwQKbVapG nxZm1cmEjh5GOs9Y/uMirXBpldf2xcf6zumU4i5dr8tVz8FWImDRycQGdetp9Y6sSMOX OjKqN63MgaOBJiP62B2zO9rUhNOl2gxu36Swpl+x2r4eNaht1034kfx45DYTPm7ZPNt7 /f0dB+pzymSKc1+W++lRpvbrMWf71/Zq4h6irz97d3g/s8L5W5U+YhaTkXh4SSWFseXw 35kN9D61gk8vzNupIN4ogBgwmhCvp9ZO+Q0OlzS/sWMpR3XZRWIu7vTH9qr0kSJbRANo JcFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=G+Jx7mb46zY0S+AknAgioBuAakKhHwTvjBNhA9+5sz4=; b=wH7VCZcbR3lVmcRlnB8HTodoRpJLED3f8LnDjhhc2QxkZKxZPJsuQT3dHoLXv3fbig nscKM8Pc/qHpQhd9YWXGT3Sc0fg9Rgwp7CKlA/W+kdFqb0n5LBq028996pda7bl160ti Gyspz15DaXhu1MG3lgk0CDj1fS9nGbVRWg++SyKEXJc3ueUnF/g/Ky0O+IhY6UuROytI m1JC9I0BelFYHyxQkCywK7hf+vbeKw4yunGC9gOnB97+fEVwPP6LowAVKmcc/qo/hp/W QAKFbaRckIWnhXSaN+UmjjE1fhx/dVi/NmgoZzOJYryArplKmi/OMP2Z3YRmpVxJGwCd 2Sug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id x8si7987690pge.185.2017.05.19.03.47.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 May 2017 03:47:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A581521A16EEF; Fri, 19 May 2017 03:47:53 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wr0-x22e.google.com (mail-wr0-x22e.google.com [IPv6:2a00:1450:400c:c0c::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DDC5221A16EC2 for ; Fri, 19 May 2017 03:47:51 -0700 (PDT) Received: by mail-wr0-x22e.google.com with SMTP id z52so14699254wrc.2 for ; Fri, 19 May 2017 03:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=reaz/7oA87h9ddNVklHiMVNsrZ09oqfSToL20Bv6E8s=; b=hFjP7CdpzBDZsS7eCLupfnmZJQI6a0Mf5PK2ieVT3o62yfKObaDnC2sKKMcO0UgGmA 90ZIKV7AU12SYcVbrQG3A2/az4s1w6plWIXZEQwQN5YoYHtF0/noaPv9i14npyp5aLyO /D+rSoVL0Kct9rAVwHmlo03rguRuqyMzG6WE4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=reaz/7oA87h9ddNVklHiMVNsrZ09oqfSToL20Bv6E8s=; b=roD9qK4f7Fu5z2lECnDS+9XX4N0VrHZ29mGBiWZmTeMXgDIWzNkaFUMA6UoothncKI RLaCzk5ulvmoVOIpye4rFDy0l/Wy9rShbLDs7XM+XZpfIJ8oi+48GnYtlRIfmZ6m1MXM 0l+vLLnkAeS/v9cWmveeiGUdJDks+vOfxPCeTrMQZNSxt0zZoUgb51Qj9Qmgp6Y5bTCx p+YLm5xiE/fYLjfm8BphERIulmhl5+y04aPnzOfzzFGXQ4j6easMFOeBTIJX+boWUMDv pePkXD3w/0r5U7LhHnpNgmZ4HOe4zMPUgUa91w3LCzayxrJ55CnjwWY4ogQ0ecWu7Yoa 2USA== X-Gm-Message-State: AODbwcDGd4DGxl4Y7RozxYHYfJWMMNGRWd1BkGuErImIf7WVRgO/oxeH 67SIoGjOj1babwbD X-Received: by 10.223.167.76 with SMTP id e12mr2567355wrd.177.1495190870478; Fri, 19 May 2017 03:47:50 -0700 (PDT) Received: from localhost.localdomain ([105.129.238.81]) by smtp.gmail.com with ESMTPSA id l7sm3619866wrc.52.2017.05.19.03.47.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 May 2017 03:47:48 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 19 May 2017 11:47:40 +0100 Message-Id: <20170519104740.16044-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 Subject: [edk2] [PATCH] BaseTools/Scripts: discard .gnu.hash section in GCC builds X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: liming.gao@intel.com, leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Some builds of GCC/binutils will default to using the GNU flavor of the symbol hash table, and will emit it into a section called .gnu.hash rather than .hash. We have no use for its contents, and GenFw ignores it anyway, so it shouldn't really matter what we do with it. However, due to a workaround for AARCH64 we have in GenFw to deal with older GCCs that corrupt section-based relocations when merging sections during the final link, we need the ELF and PE/COFF views of the binary to be identical. Since we don't place the .gnu.hash section explicitly, it may end up at the beginning of the ELF binary, causing other sections to be shifted in the ELF view but not in the PE/COFF view. So let's add .gnu.hash to the GCC linker script. We don't care about its contents so add it to the /DISCARD/ section. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- BaseTools/Scripts/GccBase.lds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Tested-by: Leif Lindholm Reviewed-by: Liming Gao diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds index 41e5c0b4a769..a43e0072f2b4 100644 --- a/BaseTools/Scripts/GccBase.lds +++ b/BaseTools/Scripts/GccBase.lds @@ -78,7 +78,7 @@ SECTIONS { *(.dynsym) *(.dynstr) *(.dynamic) - *(.hash) + *(.hash .gnu.hash) *(.comment) *(COMMON) }