BaseTools: Add GCC49 toolchain; align data sections to 0x40
authorJordan Justen <jordan.l.justen@intel.com>
Mon, 28 Jul 2014 17:37:10 +0000 (17:37 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 28 Jul 2014 17:37:10 +0000 (17:37 +0000)
GCC 4.9 may use 64-byte (0x40) alignment for data sections.

Therefore we use a different link script for GCC 4.9. The only
difference from the gcc4.4-ld-script is the alignment for data
sections.

When using the GCC48 toolchain with GCC 4.9, this error would be
encountered by GenFw:
> GenFw: ERROR 3000: Invalid
>   Unsupported section alignment.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15697 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Conf/tools_def.template
BaseTools/Scripts/gcc4.9-ld-script [new file with mode: 0644]

index f99ddf60ea7e5f085eb052d5b575b80aae7f2078..f9e1e6c8480b6049aacacd9652280249a8102bee 100644 (file)
@@ -162,6 +162,9 @@ DEFINE GCC47_X64_PREFIX        = /usr/bin/
 DEFINE GCC48_IA32_PREFIX       = /usr/bin/\r
 DEFINE GCC48_X64_PREFIX        = /usr/bin/\r
 \r
+DEFINE GCC49_IA32_PREFIX       = /usr/bin/\r
+DEFINE GCC49_X64_PREFIX        = /usr/bin/\r
+\r
 DEFINE UNIX_IASL_BIN           = ENV(IASL_PREFIX)iasl\r
 DEFINE WIN_ASL_BIN_DIR         = C:\ASL\r
 DEFINE WIN_IASL_BIN            = DEF(WIN_ASL_BIN_DIR)\iasl.exe\r
@@ -307,6 +310,12 @@ DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G
 #                             Required to build platforms or ACPI tables:\r
 #                               Intel(r) ACPI Compiler v20101013 from\r
 #                               http://www.acpica.org/downloads/previous_releases.php\r
+#   GCC49       -Linux-  Requires:\r
+#                             GCC 4.9\r
+#                        Optional:\r
+#                             Required to build platforms or ACPI tables:\r
+#                               Intel(r) ACPI Compiler v20101013 from\r
+#                               http://www.acpica.org/downloads/previous_releases.php\r
 #   ELFGCC      -Linux-  Requires:\r
 #                             GCC(this tool chain uses whatever version of gcc and binutils that is installed in /usr/bin)\r
 #                        Optional:\r
@@ -3216,6 +3225,22 @@ DEFINE GCC48_AARCH64_DLINK_FLAGS     = DEF(GCC_ARM_AARCH64_DLINK_COMMON)
 DEFINE GCC48_ARM_ASLDLINK_FLAGS      = DEF(GCC47_ARM_ASLDLINK_FLAGS)\r
 DEFINE GCC48_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS)\r
 \r
+DEFINE GCC49_IA32_CC_FLAGS           = DEF(GCC48_IA32_CC_FLAGS)\r
+DEFINE GCC49_X64_CC_FLAGS            = DEF(GCC48_X64_CC_FLAGS)\r
+DEFINE GCC49_IA32_X64_DLINK_COMMON   = -nostdlib -n -q --gc-sections --script=$(EDK_TOOLS_PATH)/Scripts/gcc4.9-ld-script\r
+DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) --entry ReferenceAcpiTable -u ReferenceAcpiTable\r
+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\r
+DEFINE GCC49_X64_DLINK_FLAGS         = DEF(GCC49_IA32_X64_DLINK_FLAGS)  -melf_x86_64 --oformat=elf64-x86-64\r
+DEFINE GCC49_ASM_FLAGS               = DEF(GCC48_ASM_FLAGS)\r
+DEFINE GCC49_ARM_ASM_FLAGS           = DEF(GCC48_ARM_ASM_FLAGS)\r
+DEFINE GCC49_AARCH64_ASM_FLAGS       = DEF(GCC48_AARCH64_ASM_FLAGS)\r
+DEFINE GCC49_ARM_CC_FLAGS            = DEF(GCC48_ARM_CC_FLAGS)\r
+DEFINE GCC49_AARCH64_CC_FLAGS        = DEF(GCC48_AARCH64_CC_FLAGS)\r
+DEFINE GCC49_ARM_DLINK_FLAGS         = DEF(GCC48_ARM_DLINK_FLAGS)\r
+DEFINE GCC49_AARCH64_DLINK_FLAGS     = DEF(GCC_ARM_AARCH64_DLINK_COMMON)\r
+DEFINE GCC49_ARM_ASLDLINK_FLAGS      = DEF(GCC48_ARM_ASLDLINK_FLAGS)\r
+DEFINE GCC49_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS)\r
+\r
 ####################################################################################\r
 #\r
 # Unix GCC And Intel Linux ACPI Compiler\r
@@ -3767,6 +3792,126 @@ RELEASE_GCC48_ARM_CC_FLAGS       = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-v
   DEBUG_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -O0\r
 RELEASE_GCC48_AARCH64_CC_FLAGS   = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable\r
 \r
+####################################################################################\r
+#\r
+# GCC 4.9 - This configuration is used to compile under Linux to produce\r
+#           PE/COFF binaries using GCC 4.9.\r
+#\r
+####################################################################################\r
+*_GCC49_*_*_FAMILY               = GCC\r
+\r
+*_GCC49_*_MAKE_PATH                    = make\r
+*_GCC49_*_ASL_PATH                     = DEF(UNIX_IASL_BIN)\r
+\r
+*_GCC49_*_PP_FLAGS                     = DEF(GCC_PP_FLAGS)\r
+*_GCC49_*_ASLPP_FLAGS                  = DEF(GCC_ASLPP_FLAGS)\r
+*_GCC49_*_ASLCC_FLAGS                  = DEF(GCC_ASLCC_FLAGS)\r
+*_GCC49_*_VFRPP_FLAGS                  = DEF(GCC_VFRPP_FLAGS)\r
+*_GCC49_*_APP_FLAGS                    =\r
+*_GCC49_*_ASL_FLAGS                    = DEF(IASL_FLAGS)\r
+*_GCC49_*_ASL_OUTFLAGS                 = DEF(IASL_OUTFLAGS)\r
+\r
+##################\r
+# GCC49 IA32 definitions\r
+##################\r
+*_GCC49_IA32_OBJCOPY_PATH         = DEF(GCC49_IA32_PREFIX)objcopy\r
+*_GCC49_IA32_CC_PATH              = DEF(GCC49_IA32_PREFIX)gcc\r
+*_GCC49_IA32_SLINK_PATH           = DEF(GCC49_IA32_PREFIX)ar\r
+*_GCC49_IA32_DLINK_PATH           = DEF(GCC49_IA32_PREFIX)ld\r
+*_GCC49_IA32_ASLDLINK_PATH        = DEF(GCC49_IA32_PREFIX)ld\r
+*_GCC49_IA32_ASM_PATH             = DEF(GCC49_IA32_PREFIX)gcc\r
+*_GCC49_IA32_PP_PATH              = DEF(GCC49_IA32_PREFIX)gcc\r
+*_GCC49_IA32_VFRPP_PATH           = DEF(GCC49_IA32_PREFIX)gcc\r
+*_GCC49_IA32_ASLCC_PATH           = DEF(GCC49_IA32_PREFIX)gcc\r
+*_GCC49_IA32_ASLPP_PATH           = DEF(GCC49_IA32_PREFIX)gcc\r
+*_GCC49_IA32_RC_PATH              = DEF(GCC49_IA32_PREFIX)objcopy\r
+\r
+*_GCC49_IA32_ASLCC_FLAGS          = DEF(GCC_ASLCC_FLAGS) -m32\r
+*_GCC49_IA32_ASLDLINK_FLAGS       = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -m elf_i386\r
+*_GCC49_IA32_ASM_FLAGS            = DEF(GCC49_ASM_FLAGS) -m32 -march=i386\r
+*_GCC49_IA32_CC_FLAGS             = DEF(GCC49_IA32_CC_FLAGS) -Os\r
+*_GCC49_IA32_DLINK_FLAGS          = DEF(GCC49_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386\r
+*_GCC49_IA32_RC_FLAGS             = DEF(GCC_IA32_RC_FLAGS)\r
+*_GCC49_IA32_OBJCOPY_FLAGS        = \r
+\r
+##################\r
+# GCC49 X64 definitions\r
+##################\r
+*_GCC49_X64_OBJCOPY_PATH         = DEF(GCC49_X64_PREFIX)objcopy\r
+*_GCC49_X64_CC_PATH              = DEF(GCC49_X64_PREFIX)gcc\r
+*_GCC49_X64_SLINK_PATH           = DEF(GCC49_X64_PREFIX)ar\r
+*_GCC49_X64_DLINK_PATH           = DEF(GCC49_X64_PREFIX)ld\r
+*_GCC49_X64_ASLDLINK_PATH        = DEF(GCC49_X64_PREFIX)ld\r
+*_GCC49_X64_ASM_PATH             = DEF(GCC49_X64_PREFIX)gcc\r
+*_GCC49_X64_PP_PATH              = DEF(GCC49_X64_PREFIX)gcc\r
+*_GCC49_X64_VFRPP_PATH           = DEF(GCC49_X64_PREFIX)gcc\r
+*_GCC49_X64_ASLCC_PATH           = DEF(GCC49_X64_PREFIX)gcc\r
+*_GCC49_X64_ASLPP_PATH           = DEF(GCC49_X64_PREFIX)gcc\r
+*_GCC49_X64_RC_PATH              = DEF(GCC49_X64_PREFIX)objcopy\r
+\r
+*_GCC49_X64_ASLCC_FLAGS          = DEF(GCC_ASLCC_FLAGS) -m64\r
+*_GCC49_X64_ASLDLINK_FLAGS       = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64\r
+*_GCC49_X64_ASM_FLAGS            = DEF(GCC49_ASM_FLAGS) -m64\r
+*_GCC49_X64_CC_FLAGS             = DEF(GCC49_X64_CC_FLAGS)\r
+*_GCC49_X64_DLINK_FLAGS          = DEF(GCC49_X64_DLINK_FLAGS)\r
+*_GCC49_X64_RC_FLAGS             = DEF(GCC_X64_RC_FLAGS)\r
+*_GCC49_X64_OBJCOPY_FLAGS        = \r
+\r
+##################\r
+# GCC49 ARM definitions\r
+##################\r
+*_GCC49_ARM_CC_PATH              = ENV(GCC49_ARM_PREFIX)gcc\r
+*_GCC49_ARM_SLINK_PATH           = ENV(GCC49_ARM_PREFIX)ar\r
+*_GCC49_ARM_DLINK_PATH           = ENV(GCC49_ARM_PREFIX)ld\r
+*_GCC49_ARM_ASLDLINK_PATH        = ENV(GCC49_ARM_PREFIX)ld\r
+*_GCC49_ARM_ASM_PATH             = ENV(GCC49_ARM_PREFIX)gcc\r
+*_GCC49_ARM_PP_PATH              = ENV(GCC49_ARM_PREFIX)gcc\r
+*_GCC49_ARM_VFRPP_PATH           = ENV(GCC49_ARM_PREFIX)gcc\r
+*_GCC49_ARM_ASLCC_PATH           = ENV(GCC49_ARM_PREFIX)gcc\r
+*_GCC49_ARM_ASLPP_PATH           = ENV(GCC49_ARM_PREFIX)gcc\r
+*_GCC49_ARM_RC_PATH              = ENV(GCC49_ARM_PREFIX)objcopy\r
+\r
+*_GCC49_ARM_ARCHCC_FLAGS         = -mthumb\r
+*_GCC49_ARM_PLATFORM_FLAGS       = -march=armv7-a\r
+\r
+*_GCC49_ARM_ASLCC_FLAGS          = DEF(GCC_ASLCC_FLAGS)\r
+*_GCC49_ARM_ASLDLINK_FLAGS       = DEF(GCC49_ARM_ASLDLINK_FLAGS)\r
+*_GCC49_ARM_ASM_FLAGS            = DEF(GCC49_ARM_ASM_FLAGS)\r
+*_GCC49_ARM_DLINK_FLAGS          = DEF(GCC49_ARM_DLINK_FLAGS)\r
+*_GCC49_ARM_PLATFORM_FLAGS       = -march=armv7-a\r
+*_GCC49_ARM_PP_FLAGS             = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)\r
+*_GCC49_ARM_RC_FLAGS             = DEF(GCC_ARM_RC_FLAGS)\r
+*_GCC49_ARM_VFRPP_FLAGS          = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)\r
+\r
+  DEBUG_GCC49_ARM_CC_FLAGS       = DEF(GCC49_ARM_CC_FLAGS) -O0\r
+RELEASE_GCC49_ARM_CC_FLAGS       = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-variable\r
+\r
+##################\r
+# GCC49 AARCH64 definitions\r
+##################\r
+*_GCC49_AARCH64_CC_PATH          = ENV(GCC49_AARCH64_PREFIX)gcc\r
+*_GCC49_AARCH64_SLINK_PATH       = ENV(GCC49_AARCH64_PREFIX)ar\r
+*_GCC49_AARCH64_DLINK_PATH       = ENV(GCC49_AARCH64_PREFIX)ld\r
+*_GCC49_AARCH64_ASLDLINK_PATH    = ENV(GCC49_AARCH64_PREFIX)ld\r
+*_GCC49_AARCH64_ASM_PATH         = ENV(GCC49_AARCH64_PREFIX)gcc\r
+*_GCC49_AARCH64_PP_PATH          = ENV(GCC49_AARCH64_PREFIX)gcc\r
+*_GCC49_AARCH64_VFRPP_PATH       = ENV(GCC49_AARCH64_PREFIX)gcc\r
+*_GCC49_AARCH64_ASLCC_PATH       = ENV(GCC49_AARCH64_PREFIX)gcc\r
+*_GCC49_AARCH64_ASLPP_PATH       = ENV(GCC49_AARCH64_PREFIX)gcc\r
+*_GCC49_AARCH64_RC_PATH          = ENV(GCC49_AARCH64_PREFIX)objcopy\r
+\r
+*_GCC49_AARCH64_ASLCC_FLAGS      = DEF(GCC_ASLCC_FLAGS)\r
+*_GCC49_AARCH64_ASLDLINK_FLAGS   = DEF(GCC49_AARCH64_ASLDLINK_FLAGS)\r
+*_GCC49_AARCH64_ASM_FLAGS        = DEF(GCC49_AARCH64_ASM_FLAGS)\r
+*_GCC49_AARCH64_DLINK_FLAGS      = DEF(GCC49_AARCH64_DLINK_FLAGS)\r
+*_GCC49_AARCH64_PLATFORM_FLAGS   =\r
+*_GCC49_AARCH64_PP_FLAGS         = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)\r
+*_GCC49_AARCH64_RC_FLAGS         = DEF(GCC_AARCH64_RC_FLAGS)\r
+*_GCC49_AARCH64_VFRPP_FLAGS      = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)\r
+\r
+  DEBUG_GCC49_AARCH64_CC_FLAGS   = DEF(GCC49_AARCH64_CC_FLAGS) -O0\r
+RELEASE_GCC49_AARCH64_CC_FLAGS   = DEF(GCC49_AARCH64_CC_FLAGS) -Wno-unused-but-set-variable\r
+\r
 ####################################################################################\r
 #\r
 # Cygwin GCC And Intel ACPI Compiler\r
diff --git a/BaseTools/Scripts/gcc4.9-ld-script b/BaseTools/Scripts/gcc4.9-ld-script
new file mode 100644 (file)
index 0000000..b692328
--- /dev/null
@@ -0,0 +1,44 @@
+/* OUTPUT_FORMAT(efi-bsdrv-x86_64) */\r
+SECTIONS\r
+{\r
+  /* . = 0 + SIZEOF_HEADERS; */\r
+  . = 0x280;\r
+  .text ALIGN(0x20) :\r
+  {\r
+    *(.text .stub .text.* .gnu.linkonce.t.*)\r
+    . = ALIGN(0x20);\r
+  } =0x90909090\r
+  .data ALIGN(0x40) :\r
+  {\r
+    *(\r
+      .rodata .rodata.* .gnu.linkonce.r.*\r
+      .data .data.* .gnu.linkonce.d.*\r
+      .bss .bss.*\r
+      *COM*\r
+    )\r
+    . = ALIGN(0x20);\r
+  }\r
+  .eh_frame ALIGN(0x20) :\r
+  {\r
+    KEEP (*(.eh_frame))\r
+  }\r
+  .got ALIGN(0x20) :\r
+  {\r
+    *(.got .got.*)\r
+    . = ALIGN(0x20);\r
+  }\r
+  .rela ALIGN(0x20) :\r
+  {\r
+    *(.rela .rela.*)\r
+  }\r
+  /DISCARD/ : {\r
+    *(.note.GNU-stack) *(.gnu_debuglink)\r
+    *(.interp)\r
+    *(.dynsym)\r
+    *(.dynstr)\r
+    *(.dynamic)\r
+    *(.hash)\r
+    *(.comment)\r
+  }\r
+}\r
+\r