From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EFFD221A0BA9C for ; Sun, 21 May 2017 21:05:54 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2017 21:05:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,377,1491289200"; d="scan'208";a="90062114" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga002.jf.intel.com with ESMTP; 21 May 2017 21:05:54 -0700 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 21 May 2017 21:05:54 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 21 May 2017 21:05:53 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.246]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.224]) with mapi id 14.03.0319.002; Mon, 22 May 2017 12:05:50 +0800 From: "Gao, Liming" To: Ard Biesheuvel , "edk2-devel@lists.01.org" CC: "leif.lindholm@linaro.org" , "Zhu, Yonghong" Thread-Topic: [PATCH] BaseTools/Scripts: discard .gnu.hash section in GCC builds Thread-Index: AQHS0I1lHr5WOk7Yck+b7FAmmkPExaH/wEdA Date: Mon, 22 May 2017 04:05:49 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D7326EA@shsmsx102.ccr.corp.intel.com> References: <20170519104740.16044-1-ard.biesheuvel@linaro.org> In-Reply-To: <20170519104740.16044-1-ard.biesheuvel@linaro.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: Mon, 22 May 2017 04:05:55 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] >Sent: Friday, May 19, 2017 6:48 PM >To: edk2-devel@lists.01.org >Cc: leif.lindholm@linaro.org; Zhu, Yonghong ; Gao, >Liming ; Ard Biesheuvel >Subject: [PATCH] BaseTools/Scripts: discard .gnu.hash section in GCC build= s > >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