audk/BaseTools/Scripts
Ard Biesheuvel 669a7562cb BaseTools/GccBase.lds: don't copy RELA section to PE/COFF
The CLANG38 toolchain creates a PIE binary at link time. This is
necessary since the LTO code generation may otherwise result in
code that cannot execute correctly when loaded above 2 GB.

PIE executables contain a RELA section consisting of dynamic
relocation entries that are intended for consumption by the loader
at runtime. For this reason, it has the SHF_ALLOC attribute set by
default, and will be identified by GenFw as a section that needs to
be copied into the PE/COFF binary, resulting in waste of space since
the PE/COFF loader does not use this data at all.

So mark the RELA section as informational: this will prevent the
linker from setting the SHF_ALLOC attribute, causing GenFw to
ignore it.

DxeCore.efi before:

    Detected 'X64' type PE/COFF image consisting of 3 sections
    Section alignment:      0x40
    File alignment:         0x40
    Section '.text' @ 0x00000240
    File offset:            0x240
    Virtual size:           0x21000
    Raw size:               0x21000
    Section '.data' @ 0x00021240
    File offset:            0x21240
    Virtual size:           0x3640
    Raw size:               0x3640
    Section '.reloc' @ 0x00024880
    File offset:            0x24880
    Virtual size:           0x280
    Raw size:               0x280

DxeCore.efi after:

    Detected 'X64' type PE/COFF image consisting of 3 sections
    Section alignment:      0x40
    File alignment:         0x40
    Section '.text' @ 0x00000240
    File offset:            0x240
    Virtual size:           0x1f440
    Raw size:               0x1f440
    Section '.data' @ 0x0001f680
    File offset:            0x1f680
    Virtual size:           0x3640
    Raw size:               0x3640
    Section '.reloc' @ 0x00022cc0
    File offset:            0x22cc0
    Virtual size:           0x280
    Raw size:               0x280

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-22 12:26:42 +02:00
..
ConvertMasmToNasm.py BaseTools ConvertMasmToNasm: Don't try to reconvert .nasm files 2016-06-28 13:16:53 -07:00
ConvertUni.py BaseTools/Scripts: Add ConvertUni.py script 2015-12-15 04:50:50 +00:00
GccBase.lds BaseTools/GccBase.lds: don't copy RELA section to PE/COFF 2016-08-22 12:26:42 +02:00
MemoryProfileSymbolGen.py BaseTools MemoryProfileSymbolGen.py: Handle 64bits rva from "nm -l xxx.dll" 2016-07-05 17:25:38 +08:00
PatchCheck.py BaseTools PatchCheck.py: Support binary diff 2015-12-03 08:18:00 +00:00
Rvct-Align4K.sct BaseTools RVCT: use scatter file to enforce minimum section alignment 2015-12-14 07:55:46 +00:00
Rvct-Align32.sct BaseTools RVCT: use scatter file to enforce minimum section alignment 2015-12-14 07:55:46 +00:00
SetVisualStudio.bat BaseTools: Update Scripts to support VS2015 env 2015-12-22 01:01:54 +00:00
ShowEnvironment.bat BaseTools: Update Scripts to support VS2015 env 2015-12-22 01:01:54 +00:00
UpdateBuildVersions.py 1. Update UpdateBuildVersion.py; 2015-02-06 03:40:27 +00:00