From: Leif Lindholm <leif.lindholm@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: edk2-devel@lists.01.org, yonghong.zhu@intel.com, liming.gao@intel.com
Subject: Re: [PATCH] BaseTools/Scripts: discard .gnu.hash section in GCC builds
Date: Fri, 19 May 2017 11:58:27 +0100 [thread overview]
Message-ID: <20170519105827.GE1657@bivouac.eciton.net> (raw)
In-Reply-To: <20170519104740.16044-1-ard.biesheuvel@linaro.org>
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 <ard.biesheuvel@linaro.org>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> 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
>
next prev parent reply other threads:[~2017-05-19 10:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 10:47 [PATCH] BaseTools/Scripts: discard .gnu.hash section in GCC builds Ard Biesheuvel
2017-05-19 10:58 ` Leif Lindholm [this message]
2017-05-22 4:05 ` Gao, Liming
2017-05-24 13:13 ` Ard Biesheuvel
2017-05-27 9:05 ` Gao, Liming
2017-05-28 12:08 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170519105827.GE1657@bivouac.eciton.net \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox