When a section's start address is set explicitly and is not aligned to the alignment of its contents, the linker will rearrange them so that everything lines up provided that the misalignment is preserved.
Since we cannot do the same in PE/COFF, don't set the .data start address directly, but advance the location pointer by the same amount. This way, the linker will be free to choose the start address, but will ultimately end up using the exact same value. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- BaseTools/Scripts/GccBase.lds | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds index 4ee6d998532c..eef8325c96a5 100644 --- a/BaseTools/Scripts/GccBase.lds +++ b/BaseTools/Scripts/GccBase.lds @@ -44,7 +44,8 @@ SECTIONS { * between these sections is the same in the ELF and the PE/COFF versions of * this binary. */ - .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) { + . = ALIGN(ALIGNOF(.text)); + .data : ALIGN(CONSTANT(COMMONPAGESIZE)) { *(.data .data.* .gnu.linkonce.d.*) *(.bss .bss.* *COM*) } -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel