The MS ABI uses leading underscores to decorate symbol names only
when generating 32-bit code. Due to a bug in GCC prior to version 4.3,
it used the same decoration for 64-bit code but this has been fixed
since. So uses the leading underscore for IA32 only, and remove it
for X64.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
---
 BaseTools/Conf/tools_def.template | 22 +++++++++++---------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index ee3275c7f668..1304f514cd37 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3824,10 +3824,12 @@ DEFINE GCC_IA32_X64_DLINK_COMMON   = 
DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
 DEFINE GCC_ARM_AARCH64_DLINK_COMMON= --emit-relocs -nostdlib --gc-sections -u 
$(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 DEFINE GCC_ARM_DLINK_FLAGS         = DEF(GCC_ARM_AARCH64_DLINK_COMMON) 
-Ttext=0x0
 DEFINE GCC_AARCH64_DLINK_FLAGS     = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z 
common-page-size=0x20
-DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry 
_ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
+DEFINE GCC_IA32_ASLDLINK_FLAGS     = DEF(GCC_IA32_X64_DLINK_COMMON) --entry 
_ReferenceAcpiTable -u _$(IMAGE_ENTRY_POINT)
+DEFINE GCC_X64_ASLDLINK_FLAGS      = DEF(GCC_IA32_X64_DLINK_COMMON) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
 DEFINE GCC_ARM_ASLDLINK_FLAGS      = DEF(GCC_ARM_DLINK_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
 DEFINE GCC_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_AARCH64_DLINK_FLAGS) --entry 
ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
-DEFINE GCC_IA32_X64_DLINK_FLAGS    = DEF(GCC_IA32_X64_DLINK_COMMON) --entry 
_$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC_IA32_DLINK_FLAGS        = DEF(GCC_IA32_X64_DLINK_COMMON) --entry 
_$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC_X64_DLINK_FLAGS         = DEF(GCC_IA32_X64_DLINK_COMMON) --entry 
$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 DEFINE GCC_IPF_DLINK_FLAGS         = -nostdlib -O2 --gc-sections --dll -static 
--entry $(IMAGE_ENTRY_POINT) --undefined $(IMAGE_ENTRY_POINT) -Map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
 DEFINE GCC_IPF_OBJCOPY_FLAGS       = -I elf64-ia64-little -O efi-bsdrv-ia64
 DEFINE GCC_IPF_SYMRENAME_FLAGS     = --redefine-sym memcpy=CopyMem
@@ -3933,10 +3935,10 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS  = 
DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
 *_UNIXGCC_*_MAKE_PATH                    = make
 *_UNIXGCC_*_ASL_PATH                     = DEF(UNIX_IASL_BIN)
 
-*_UNIXGCC_IA32_DLINK_FLAGS               = DEF(GCC_IA32_X64_DLINK_FLAGS) 
--image-base=0
-*_UNIXGCC_X64_DLINK_FLAGS                = DEF(GCC_IA32_X64_DLINK_FLAGS) 
--image-base=0
-*_UNIXGCC_IA32_ASLDLINK_FLAGS            = DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
-*_UNIXGCC_X64_ASLDLINK_FLAGS             = DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
+*_UNIXGCC_IA32_DLINK_FLAGS               = DEF(GCC_IA32_DLINK_FLAGS) 
--image-base=0
+*_UNIXGCC_X64_DLINK_FLAGS                = DEF(GCC_X64_DLINK_FLAGS) 
--image-base=0
+*_UNIXGCC_IA32_ASLDLINK_FLAGS            = DEF(GCC_IA32_ASLDLINK_FLAGS)
+*_UNIXGCC_X64_ASLDLINK_FLAGS             = DEF(GCC_X64_ASLDLINK_FLAGS)
 *_UNIXGCC_*_ASM_FLAGS                    = DEF(GCC_ASM_FLAGS)
 *_UNIXGCC_*_PP_FLAGS                     = DEF(GCC_PP_FLAGS)
 *_UNIXGCC_*_ASLPP_FLAGS                  = DEF(GCC_ASLPP_FLAGS)
@@ -4692,10 +4694,10 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = 
DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
 *_CYGGCC_*_MAKE_PATH             = DEF(MS_VS_BIN)\nmake.exe
 *_CYGGCC_*_ASL_PATH              = DEF(DEFAULT_WIN_ASL_BIN)
 
-*_CYGGCC_IA32_DLINK_FLAGS               = DEF(GCC_IA32_X64_DLINK_FLAGS) 
--image-base=0
-*_CYGGCC_X64_DLINK_FLAGS                = DEF(GCC_IA32_X64_DLINK_FLAGS) 
--image-base=0
-*_CYGGCC_IA32_ASLDLINK_FLAGS            = DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
-*_CYGGCC_X64_ASLDLINK_FLAGS             = DEF(GCC_IA32_X64_ASLDLINK_FLAGS)
+*_CYGGCC_IA32_DLINK_FLAGS               = DEF(GCC_IA32_DLINK_FLAGS) 
--image-base=0
+*_CYGGCC_X64_DLINK_FLAGS                = DEF(GCC_X64_DLINK_FLAGS) 
--image-base=0
+*_CYGGCC_IA32_ASLDLINK_FLAGS            = DEF(GCC_IA32_ASLDLINK_FLAGS)
+*_CYGGCC_X64_ASLDLINK_FLAGS             = DEF(GCC_X64_ASLDLINK_FLAGS)
 *_CYGGCC_*_MAKE_FLAGS                   = /nologo
 *_CYGGCC_*_ASM_FLAGS                    = DEF(GCC_ASM_FLAGS)
 *_CYGGCC_*_PP_FLAGS                     = DEF(GCC_PP_FLAGS)
-- 
1.9.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to