From 7fd5d619806df5e5b9bdbd0cfe14580040ea3615 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Wed, 27 Jul 2016 11:13:58 +0200 Subject: BaseTools GCC: drop GNU notes section from EFI image Recent versions of GNU ld automatically emit a .notes section into the ELF binary containing a build id. Since this is an allocatable section by default, it will be identified by GenFw as a section that requires PE/COFF conversion, which may cause sections to be moved around unexpectedly. So retain the section, but tag it as INFO, which tells the linker that it should not be accounted for in the binary's memory layout. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Acked-by: Jordan Justen Reviewed-by: Liming Gao --- BaseTools/Scripts/GccBase.lds | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds index 7e4cdde9bf..281af8a9bd 100644 --- a/BaseTools/Scripts/GccBase.lds +++ b/BaseTools/Scripts/GccBase.lds @@ -62,6 +62,12 @@ SECTIONS { KEEP (*(.hii)) } + /* + * Retain the GNU build id but in a non-allocatable section so GenFw + * does not copy it into the PE/COFF image. + */ + .build-id (INFO) : { *(.note.gnu.build-id) } + /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) -- cgit v1.2.3