From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: leif.lindholm@linaro.org, yonghong.zhu@intel.com, liming.gao@intel.com, Ard Biesheuvel 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: [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: , X-List-Received-Date: Fri, 19 May 2017 10:47:52 -0000 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(-) 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) } -- 2.9.3