From c28a4ab663ec3019bef5316ec569c0791e40e924 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Mon, 3 Aug 2015 08:22:16 +0000 Subject: BaseTools IA32/X64: get header size and alignment from ld commandline Instead of hardcoding the values for the PE/COFF header size and the section alignment, set them on the linker command line. This factors out these values from the various linker scripts, which will allow us to unify them in a subsequent patch. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Jordan Justen Tested-by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18134 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Scripts/gcc-4K-align-ld-script | 10 +++++----- BaseTools/Scripts/gcc4.4-ld-script | 10 +++++----- BaseTools/Scripts/gcc4.9-ld-script | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'BaseTools/Scripts') diff --git a/BaseTools/Scripts/gcc-4K-align-ld-script b/BaseTools/Scripts/gcc-4K-align-ld-script index 34957a5314..51daae04d8 100644 --- a/BaseTools/Scripts/gcc-4K-align-ld-script +++ b/BaseTools/Scripts/gcc-4K-align-ld-script @@ -2,14 +2,14 @@ SECTIONS { /* . = 0 + SIZEOF_HEADERS; */ - . = 0x280; - .text : ALIGN(0x1000) + . = PECOFF_HEADER_SIZE; + .text : ALIGN(CONSTANT(COMMONPAGESIZE)) { *(.text .stub .text.* .gnu.linkonce.t.*) *(.rodata .rodata.* .gnu.linkonce.r.*) *(.got .got.*) } - .data : ALIGN(0x1000) + .data : ALIGN(CONSTANT(COMMONPAGESIZE)) { *( .data .data.* .gnu.linkonce.d.* @@ -17,11 +17,11 @@ SECTIONS *COM* ) } - .eh_frame : ALIGN(0x1000) + .eh_frame : ALIGN(CONSTANT(COMMONPAGESIZE)) { KEEP (*(.eh_frame)) } - .rela : ALIGN(0x1000) + .rela : ALIGN(CONSTANT(COMMONPAGESIZE)) { *(.rela .rela.*) } diff --git a/BaseTools/Scripts/gcc4.4-ld-script b/BaseTools/Scripts/gcc4.4-ld-script index 48320c6611..ebb2e1d1b7 100644 --- a/BaseTools/Scripts/gcc4.4-ld-script +++ b/BaseTools/Scripts/gcc4.4-ld-script @@ -2,14 +2,14 @@ SECTIONS { /* . = 0 + SIZEOF_HEADERS; */ - . = 0x280; - .text ALIGN(0x20) : + . = PECOFF_HEADER_SIZE; + .text ALIGN(CONSTANT(COMMONPAGESIZE)) : { *(.text .stub .text.* .gnu.linkonce.t.*) *(.rodata .rodata.* .gnu.linkonce.r.*) *(.got .got.*) } - .data ALIGN(0x20) : + .data ALIGN(CONSTANT(COMMONPAGESIZE)) : { *( .data .data.* .gnu.linkonce.d.* @@ -17,11 +17,11 @@ SECTIONS *COM* ) } - .eh_frame ALIGN(0x20) : + .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : { KEEP (*(.eh_frame)) } - .rela ALIGN(0x20) : + .rela ALIGN(CONSTANT(COMMONPAGESIZE)) : { *(.rela .rela.*) } diff --git a/BaseTools/Scripts/gcc4.9-ld-script b/BaseTools/Scripts/gcc4.9-ld-script index 3dff0b2907..ebb2e1d1b7 100644 --- a/BaseTools/Scripts/gcc4.9-ld-script +++ b/BaseTools/Scripts/gcc4.9-ld-script @@ -2,14 +2,14 @@ SECTIONS { /* . = 0 + SIZEOF_HEADERS; */ - . = 0x280; - .text ALIGN(0x20) : + . = PECOFF_HEADER_SIZE; + .text ALIGN(CONSTANT(COMMONPAGESIZE)) : { *(.text .stub .text.* .gnu.linkonce.t.*) *(.rodata .rodata.* .gnu.linkonce.r.*) *(.got .got.*) } - .data ALIGN(0x40) : + .data ALIGN(CONSTANT(COMMONPAGESIZE)) : { *( .data .data.* .gnu.linkonce.d.* @@ -17,11 +17,11 @@ SECTIONS *COM* ) } - .eh_frame ALIGN(0x20) : + .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : { KEEP (*(.eh_frame)) } - .rela ALIGN(0x20) : + .rela ALIGN(CONSTANT(COMMONPAGESIZE)) : { *(.rela .rela.*) } -- cgit v1.2.3