summaryrefslogtreecommitdiff
path: root/BaseTools/Conf
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2015-08-03 08:22:16 +0000
committerabiesheuvel <abiesheuvel@Edk2>2015-08-03 08:22:16 +0000
commitc28a4ab663ec3019bef5316ec569c0791e40e924 (patch)
tree36cf9022d1b8b8ecf54d1d282e10cc1d395507ff /BaseTools/Conf
parent25e63063e3a2817fd56fd47fffb11173472a15de (diff)
downloadedk2-c28a4ab663ec3019bef5316ec569c0791e40e924.zip
edk2-c28a4ab663ec3019bef5316ec569c0791e40e924.tar.gz
edk2-c28a4ab663ec3019bef5316ec569c0791e40e924.tar.bz2
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 <ard.biesheuvel@linaro.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18134 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Conf')
-rw-r--r--BaseTools/Conf/tools_def.template28
1 files changed, 26 insertions, 2 deletions
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 8e5750e..8f84b55 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3846,10 +3846,12 @@ DEFINE GCC_AARCH64_RC_FLAGS = -I binary -O elf64-littleaarch64 -B aarch64
DEFINE GCC44_ALL_CC_FLAGS = -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -c -include AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
DEFINE GCC44_IA32_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m32 -malign-double -fno-stack-protector -D EFI32
DEFINE GCC44_X64_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS -mno-red-zone -Wno-address -mcmodel=large
-DEFINE GCC44_IA32_X64_DLINK_COMMON = -nostdlib -n -q --gc-sections --script=$(EDK_TOOLS_PATH)/Scripts/gcc4.4-ld-script
+DEFINE GCC44_IA32_X64_DLINK_COMMON = -nostdlib -n -q --gc-sections -z common-page-size=0x20
DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) --entry ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE GCC44_IA32_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC44_IA32_DLINK2_FLAGS = --script=$(EDK_TOOLS_PATH)/Scripts/gcc4.4-ld-script --defsym=PECOFF_HEADER_SIZE=0x220
DEFINE GCC44_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -melf_x86_64 --oformat=elf64-x86-64
+DEFINE GCC44_X64_DLINK2_FLAGS = --script=$(EDK_TOOLS_PATH)/Scripts/gcc4.4-ld-script --defsym=PECOFF_HEADER_SIZE=0x228
DEFINE GCC44_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
DEFINE GCC45_IA32_CC_FLAGS = DEF(GCC44_IA32_CC_FLAGS)
@@ -3857,7 +3859,9 @@ DEFINE GCC45_X64_CC_FLAGS = DEF(GCC44_X64_CC_FLAGS)
DEFINE GCC45_IA32_X64_DLINK_COMMON = DEF(GCC44_IA32_X64_DLINK_COMMON)
DEFINE GCC45_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS)
DEFINE GCC45_IA32_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS)
+DEFINE GCC45_IA32_DLINK2_FLAGS = DEF(GCC44_IA32_DLINK2_FLAGS)
DEFINE GCC45_X64_DLINK_FLAGS = DEF(GCC44_X64_DLINK_FLAGS)
+DEFINE GCC45_X64_DLINK2_FLAGS = DEF(GCC44_X64_DLINK2_FLAGS)
DEFINE GCC45_ASM_FLAGS = DEF(GCC44_ASM_FLAGS)
DEFINE GCC46_IA32_CC_FLAGS = DEF(GCC45_IA32_CC_FLAGS) -Wno-address -Wno-unused-but-set-variable
@@ -3865,7 +3869,9 @@ DEFINE GCC46_X64_CC_FLAGS = DEF(GCC45_X64_CC_FLAGS) -Wno-address -Wno
DEFINE GCC46_IA32_X64_DLINK_COMMON = DEF(GCC45_IA32_X64_DLINK_COMMON)
DEFINE GCC46_IA32_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS)
DEFINE GCC46_IA32_X64_DLINK_FLAGS = DEF(GCC45_IA32_X64_DLINK_FLAGS)
+DEFINE GCC46_IA32_DLINK2_FLAGS = DEF(GCC45_IA32_DLINK2_FLAGS)
DEFINE GCC46_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
+DEFINE GCC46_X64_DLINK2_FLAGS = DEF(GCC45_X64_DLINK2_FLAGS)
DEFINE GCC46_ASM_FLAGS = DEF(GCC45_ASM_FLAGS)
DEFINE GCC46_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
DEFINE GCC46_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fstack-protector
@@ -3877,7 +3883,9 @@ DEFINE GCC47_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS)
DEFINE GCC47_IA32_X64_DLINK_COMMON = DEF(GCC46_IA32_X64_DLINK_COMMON)
DEFINE GCC47_IA32_X64_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS)
DEFINE GCC47_IA32_X64_DLINK_FLAGS = DEF(GCC46_IA32_X64_DLINK_FLAGS)
+DEFINE GCC47_IA32_DLINK2_FLAGS = DEF(GCC46_IA32_DLINK2_FLAGS)
DEFINE GCC47_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
+DEFINE GCC47_X64_DLINK2_FLAGS = DEF(GCC46_X64_DLINK2_FLAGS)
DEFINE GCC47_ASM_FLAGS = DEF(GCC46_ASM_FLAGS)
DEFINE GCC47_ARM_ASM_FLAGS = DEF(GCC46_ARM_ASM_FLAGS)
DEFINE GCC47_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
@@ -3893,7 +3901,9 @@ DEFINE GCC48_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS)
DEFINE GCC48_IA32_X64_DLINK_COMMON = DEF(GCC47_IA32_X64_DLINK_COMMON)
DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS)
DEFINE GCC48_IA32_X64_DLINK_FLAGS = DEF(GCC47_IA32_X64_DLINK_FLAGS)
+DEFINE GCC48_IA32_DLINK2_FLAGS = DEF(GCC47_IA32_DLINK2_FLAGS)
DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC47_X64_DLINK_FLAGS)
+DEFINE GCC48_X64_DLINK2_FLAGS = DEF(GCC47_X64_DLINK2_FLAGS)
DEFINE GCC48_ASM_FLAGS = DEF(GCC47_ASM_FLAGS)
DEFINE GCC48_ARM_ASM_FLAGS = DEF(GCC47_ARM_ASM_FLAGS)
DEFINE GCC48_AARCH64_ASM_FLAGS = DEF(GCC47_AARCH64_ASM_FLAGS)
@@ -3906,10 +3916,12 @@ DEFINE GCC48_AARCH64_ASLDLINK_FLAGS = DEF(GCC47_AARCH64_ASLDLINK_FLAGS)
DEFINE GCC49_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS)
DEFINE GCC49_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS)
-DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib -n -q --gc-sections --script=$(EDK_TOOLS_PATH)/Scripts/gcc4.9-ld-script
+DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib -n -q --gc-sections -z common-page-size=0x40
DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) --entry ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE GCC49_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC49_IA32_DLINK2_FLAGS = --script=$(EDK_TOOLS_PATH)/Scripts/gcc4.9-ld-script --defsym=PECOFF_HEADER_SIZE=0x220
DEFINE GCC49_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -melf_x86_64 --oformat=elf64-x86-64
+DEFINE GCC49_X64_DLINK2_FLAGS = --script=$(EDK_TOOLS_PATH)/Scripts/gcc4.9-ld-script --defsym=PECOFF_HEADER_SIZE=0x228
DEFINE GCC49_ASM_FLAGS = DEF(GCC48_ASM_FLAGS)
DEFINE GCC49_ARM_ASM_FLAGS = DEF(GCC48_ARM_ASM_FLAGS)
DEFINE GCC49_AARCH64_ASM_FLAGS = DEF(GCC48_AARCH64_ASM_FLAGS)
@@ -4048,6 +4060,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC44_IA32_ASM_FLAGS = DEF(GCC44_ASM_FLAGS) -m32 --32 -march=i386
*_GCC44_IA32_CC_FLAGS = DEF(GCC44_IA32_CC_FLAGS) -Os
*_GCC44_IA32_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC44_IA32_DLINK2_FLAGS = DEF(GCC44_IA32_DLINK2_FLAGS)
*_GCC44_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC44_IA32_OBJCOPY_FLAGS =
*_GCC44_IA32_NASM_FLAGS = -f elf32
@@ -4072,6 +4085,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC44_X64_ASM_FLAGS = DEF(GCC44_ASM_FLAGS) -m64 --64 -melf_x86_64
*_GCC44_X64_CC_FLAGS = DEF(GCC44_X64_CC_FLAGS)
*_GCC44_X64_DLINK_FLAGS = DEF(GCC44_X64_DLINK_FLAGS)
+*_GCC44_X64_DLINK2_FLAGS = DEF(GCC44_X64_DLINK2_FLAGS)
*_GCC44_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_GCC44_X64_OBJCOPY_FLAGS =
*_GCC44_X64_NASM_FLAGS = -f elf64
@@ -4116,6 +4130,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC45_IA32_ASM_FLAGS = DEF(GCC45_ASM_FLAGS) -m32 --32 -march=i386
*_GCC45_IA32_CC_FLAGS = DEF(GCC45_IA32_CC_FLAGS) -Os
*_GCC45_IA32_DLINK_FLAGS = DEF(GCC45_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC45_IA32_DLINK2_FLAGS = DEF(GCC45_IA32_DLINK2_FLAGS)
*_GCC45_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC45_IA32_OBJCOPY_FLAGS =
*_GCC45_IA32_NASM_FLAGS = -f elf32
@@ -4140,6 +4155,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC45_X64_ASM_FLAGS = DEF(GCC45_ASM_FLAGS) -m64 --64 -melf_x86_64
*_GCC45_X64_CC_FLAGS = DEF(GCC45_X64_CC_FLAGS)
*_GCC45_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
+*_GCC45_X64_DLINK2_FLAGS = DEF(GCC45_X64_DLINK2_FLAGS)
*_GCC45_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_GCC45_X64_OBJCOPY_FLAGS =
*_GCC45_X64_NASM_FLAGS = -f elf64
@@ -4184,6 +4200,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC46_IA32_ASM_FLAGS = DEF(GCC46_ASM_FLAGS) -m32 -march=i386
*_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os
*_GCC46_IA32_DLINK_FLAGS = DEF(GCC46_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC46_IA32_DLINK2_FLAGS = DEF(GCC46_IA32_DLINK2_FLAGS)
*_GCC46_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC46_IA32_OBJCOPY_FLAGS =
*_GCC46_IA32_NASM_FLAGS = -f elf32
@@ -4208,6 +4225,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC46_X64_ASM_FLAGS = DEF(GCC46_ASM_FLAGS) -m64 -melf_x86_64
*_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS)
*_GCC46_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
+*_GCC46_X64_DLINK2_FLAGS = DEF(GCC46_X64_DLINK2_FLAGS)
*_GCC46_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_GCC46_X64_OBJCOPY_FLAGS =
*_GCC46_X64_NASM_FLAGS = -f elf64
@@ -4282,6 +4300,7 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-v
*_GCC47_IA32_ASM_FLAGS = DEF(GCC47_ASM_FLAGS) -m32 -march=i386
*_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os
*_GCC47_IA32_DLINK_FLAGS = DEF(GCC47_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC47_IA32_DLINK2_FLAGS = DEF(GCC47_IA32_DLINK2_FLAGS)
*_GCC47_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC47_IA32_OBJCOPY_FLAGS =
*_GCC47_IA32_NASM_FLAGS = -f elf32
@@ -4306,6 +4325,7 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-v
*_GCC47_X64_ASM_FLAGS = DEF(GCC47_ASM_FLAGS) -m64
*_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS)
*_GCC47_X64_DLINK_FLAGS = DEF(GCC47_X64_DLINK_FLAGS)
+*_GCC47_X64_DLINK2_FLAGS = DEF(GCC47_X64_DLINK2_FLAGS)
*_GCC47_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_GCC47_X64_OBJCOPY_FLAGS =
*_GCC47_X64_NASM_FLAGS = -f elf64
@@ -4405,6 +4425,7 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC48_IA32_ASM_FLAGS = DEF(GCC48_ASM_FLAGS) -m32 -march=i386
*_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os
*_GCC48_IA32_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC48_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS)
*_GCC48_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC48_IA32_OBJCOPY_FLAGS =
*_GCC48_IA32_NASM_FLAGS = -f elf32
@@ -4429,6 +4450,7 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC48_X64_ASM_FLAGS = DEF(GCC48_ASM_FLAGS) -m64
*_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS)
*_GCC48_X64_DLINK_FLAGS = DEF(GCC48_X64_DLINK_FLAGS)
+*_GCC48_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS)
*_GCC48_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_GCC48_X64_OBJCOPY_FLAGS =
*_GCC48_X64_NASM_FLAGS = -f elf64
@@ -4528,6 +4550,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC49_IA32_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) -m32 -march=i386
*_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os
*_GCC49_IA32_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC49_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS)
*_GCC49_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC49_IA32_OBJCOPY_FLAGS =
*_GCC49_IA32_NASM_FLAGS = -f elf32
@@ -4552,6 +4575,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC49_X64_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) -m64
*_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS)
*_GCC49_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS)
+*_GCC49_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS)
*_GCC49_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_GCC49_X64_OBJCOPY_FLAGS =
*_GCC49_X64_NASM_FLAGS = -f elf64