From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) (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 7649621A16EEF for ; Fri, 19 May 2017 03:58:31 -0700 (PDT) Received: by mail-wm0-x22a.google.com with SMTP id 70so18343996wmq.1 for ; Fri, 19 May 2017 03:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=69tHUAszIGtijNSAj2xnXLm3wzx7wKKcXlQEfGIKHhs=; b=HCRpTB+fcHboJTRlhToV+llBOJSS+uGTOF3yb5UQkZYv2Ztf5+G5zn579qHNy4icK9 4VcjUDA2lyzL4qO7OtNA20XQDjvcK6n//IQdPqfR1YqePJX1Ap/zf3kuPDM5U9Q0Xctp zqL4ThHXQsq9IYVXm+bLy3+BwVjSZiQcGQZqo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=69tHUAszIGtijNSAj2xnXLm3wzx7wKKcXlQEfGIKHhs=; b=A9d3I5wLVeVgI2oCLJABqaH/IamLvLferKP8HV8JpeW1kcVKGrPUQe3VyWxkyuUu0F KYCbfWgyLUuHb49dLydffD5Svrl3As/Rk0+OMFZ6+yZI1MrlXOqPEsMEasYIhMEY3it2 7J5p7vj7o9yfZorzQW3k9t8lhm+BjJWGLY6UO6O/mCirwntcTPZH8JE6VG6vfAIb4bsk FH/1aopvEd3EOx5YeTapGdpc00w0eloOSZ8nLoAYKM7lHfzKzcgUynd4Pcx6PZKUBz/G Vvy8XH/lIL5krHVuXLHu7dQMNWZ2UI/s8UhDNOAk8fVZ/mIBLsRwOKhyVM4reiLRazqV oZlA== X-Gm-Message-State: AODbwcCUMtKb2UPa+YnZ0JIue7g7+XCOkm9M3gheWomOZdDhAZ4byH7V GQBq9DDXFv3qnvNt X-Received: by 10.28.134.3 with SMTP id i3mr18463004wmd.68.1495191510036; Fri, 19 May 2017 03:58:30 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id o17sm1503256wra.56.2017.05.19.03.58.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 May 2017 03:58:29 -0700 (PDT) Date: Fri, 19 May 2017 11:58:27 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, yonghong.zhu@intel.com, liming.gao@intel.com Message-ID: <20170519105827.GE1657@bivouac.eciton.net> References: <20170519104740.16044-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <20170519104740.16044-1-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) 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: Fri, 19 May 2017 10:58:31 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, May 19, 2017 at 11:47:40AM +0100, Ard Biesheuvel wrote: > 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 Tested-by: Leif Lindholm > --- > 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 >