]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools GCC: drop GNU notes section from EFI image
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 27 Jul 2016 09:13:58 +0000 (11:13 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 2 Aug 2016 08:54:11 +0000 (10:54 +0200)
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 <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Scripts/GccBase.lds

index 7e4cdde9bfea8405ce4b2b375fda903d9a64b976..281af8a9bd33477977886cc80b046e5bf47a2ba4 100644 (file)
@@ -62,6 +62,12 @@ SECTIONS {
     KEEP (*(.hii))\r
   }\r
 \r
+  /*\r
+   * Retain the GNU build id but in a non-allocatable section so GenFw\r
+   * does not copy it into the PE/COFF image.\r
+   */\r
+  .build-id (INFO) : { *(.note.gnu.build-id) }\r
+\r
   /DISCARD/ : {\r
     *(.note.GNU-stack)\r
     *(.gnu_debuglink)\r