[PATCH v5 4/8] BaseTools GCC: use 'gcc' as the linker command for GCC44 and later


Ard Biesheuvel
 

To accommodate upcoming GCCx toolchain versions that require 'gcc' to
be used as the linker in order to support LTO, switch GCC44 and later
(including CLANG35) to a new DLINK build rule that invokes 'gcc' as the
linker instead of 'ld'. Since gcc expects its command line arguments in
a different format, and expects arguments that it needs to pass to the
linker to be prefixed with '-Wl,', this involves changes to most of the
DLINK_FLAGS definitions in tools_def.template, as well as some changes to
module .INF files that set their own linker options.

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>
---
ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 2 +-
BaseTools/Conf/build_rule.template | 11 +-
BaseTools/Conf/tools_def.template | 170 ++++++++++----------
EmulatorPkg/Unix/Host/Host.inf | 6 +-
4 files changed, 97 insertions(+), 92 deletions(-)

diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
index a4ea5a05b652..5e706934f69f 100755
--- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
+++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
@@ -107,4 +107,4 @@ [Pcd]
gArmTokenSpaceGuid.PcdFvBaseAddress

[BuildOptions]
- GCC:*_*_*_DLINK_FLAGS = -pie -T $(MODULE_DIR)/Scripts/PrePi-PIE.lds
+ GCC:*_*_*_DLINK_FLAGS = -pie -Wl,-T,$(MODULE_DIR)/Scripts/PrePi-PIE.lds
diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template
index 3fea4f456118..eb4ae749fda5 100644
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -291,7 +291,11 @@
<Command.MSFT, Command.INTEL>
"$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)

- <Command.GCC, Command.GCCLD>
+ <Command.GCC>
+ "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(DLINK2_FLAGS)
+ "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
+
+ <Command.GCCLD>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}

@@ -319,7 +323,10 @@
<Command.MSFT, Command.INTEL>
"$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)

- <Command.GCC, Command.GCCLD>
+ <Command.GCC>
+ "$(DLINK)" $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(DLINK2_FLAGS)
+
+ <Command.GCCLD>
"$(DLINK)" $(DLINK_FLAGS) --start-group $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)

<Command.RVCT>
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 8a04e38e1288..10ac21e42c8f 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4329,14 +4329,14 @@ DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi
DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables
DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align
DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie
-DEFINE GCC_DLINK2_FLAGS_COMMON = --script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
+DEFINE GCC_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
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_AARCH64_DLINK_COMMON= -Wl,--emit-relocs -nostdlib -Wl,--gc-sections -u $(IMAGE_ENTRY_POINT) -Wl,-e,$(IMAGE_ENTRY_POINT),-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
DEFINE GCC_ARM_DLINK_FLAGS = DEF(GCC_ARM_AARCH64_DLINK_COMMON) -z common-page-size=0x20
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_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_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
+DEFINE GCC_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -Wl,--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_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
@@ -4356,12 +4356,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 -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
DEFINE GCC44_IA32_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables
DEFINE GCC44_X64_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -Os -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables
-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 = --defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
-DEFINE GCC44_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -melf_x86_64 --oformat=elf64-x86-64
-DEFINE GCC44_X64_DLINK2_FLAGS = --defsym=PECOFF_HEADER_SIZE=0x228 DEF(GCC_DLINK2_FLAGS_COMMON)
+DEFINE GCC44_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
+DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+DEFINE GCC44_IA32_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
+DEFINE GCC44_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
+DEFINE GCC44_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -Wl,-melf_x86_64,--oformat=elf64-x86-64
+DEFINE GCC44_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 DEF(GCC_DLINK2_FLAGS_COMMON)
DEFINE GCC44_ASM_FLAGS = DEF(GCC_ASM_FLAGS)

DEFINE GCC45_IA32_CC_FLAGS = DEF(GCC44_IA32_CC_FLAGS)
@@ -4385,9 +4385,9 @@ 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 -mword-relocations -save-temps
-DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) --oformat=elf32-littlearm
-DEFINE GCC46_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x220
-DEFINE GCC46_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS) --oformat=elf32-littlearm
+DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--oformat=elf32-littlearm
+DEFINE GCC46_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
+DEFINE GCC46_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS) -Wl,--oformat=elf32-littlearm

DEFINE GCC47_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS)
DEFINE GCC47_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS)
@@ -4406,7 +4406,7 @@ DEFINE GCC47_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
DEFINE GCC47_ARM_DLINK2_FLAGS = DEF(GCC46_ARM_DLINK2_FLAGS)
DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS)
-DEFINE GCC47_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x228
+DEFINE GCC47_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
DEFINE GCC47_ARM_ASLDLINK_FLAGS = DEF(GCC46_ARM_ASLDLINK_FLAGS)
DEFINE GCC47_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_ASLDLINK_FLAGS)

@@ -4433,11 +4433,11 @@ 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 -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_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40
+DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+DEFINE GCC49_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map
DEFINE GCC49_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS)
-DEFINE GCC49_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -melf_x86_64 --oformat=elf64-x86-64
+DEFINE GCC49_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -Wl,-melf_x86_64,--oformat=elf64-x86-64
DEFINE GCC49_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS)
DEFINE GCC49_ASM_FLAGS = DEF(GCC48_ASM_FLAGS)
DEFINE GCC49_ARM_ASM_FLAGS = DEF(GCC48_ARM_ASM_FLAGS)
@@ -4567,8 +4567,8 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC44_IA32_OBJCOPY_PATH = DEF(GCC44_IA32_PREFIX)objcopy
*_GCC44_IA32_CC_PATH = DEF(GCC44_IA32_PREFIX)gcc
*_GCC44_IA32_SLINK_PATH = DEF(GCC44_IA32_PREFIX)ar
-*_GCC44_IA32_DLINK_PATH = DEF(GCC44_IA32_PREFIX)ld
-*_GCC44_IA32_ASLDLINK_PATH = DEF(GCC44_IA32_PREFIX)ld
+*_GCC44_IA32_DLINK_PATH = DEF(GCC44_IA32_PREFIX)gcc
+*_GCC44_IA32_ASLDLINK_PATH = DEF(GCC44_IA32_PREFIX)gcc
*_GCC44_IA32_ASM_PATH = DEF(GCC44_IA32_PREFIX)gcc
*_GCC44_IA32_PP_PATH = DEF(GCC44_IA32_PREFIX)gcc
*_GCC44_IA32_VFRPP_PATH = DEF(GCC44_IA32_PREFIX)gcc
@@ -4577,10 +4577,10 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC44_IA32_RC_PATH = DEF(GCC44_IA32_PREFIX)objcopy

*_GCC44_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC44_IA32_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC44_IA32_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_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_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -Wl,-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 =
@@ -4592,8 +4592,8 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC44_X64_OBJCOPY_PATH = DEF(GCC44_X64_PREFIX)objcopy
*_GCC44_X64_CC_PATH = DEF(GCC44_X64_PREFIX)gcc
*_GCC44_X64_SLINK_PATH = DEF(GCC44_X64_PREFIX)ar
-*_GCC44_X64_DLINK_PATH = DEF(GCC44_X64_PREFIX)ld
-*_GCC44_X64_ASLDLINK_PATH = DEF(GCC44_X64_PREFIX)ld
+*_GCC44_X64_DLINK_PATH = DEF(GCC44_X64_PREFIX)gcc
+*_GCC44_X64_ASLDLINK_PATH = DEF(GCC44_X64_PREFIX)gcc
*_GCC44_X64_ASM_PATH = DEF(GCC44_X64_PREFIX)gcc
*_GCC44_X64_PP_PATH = DEF(GCC44_X64_PREFIX)gcc
*_GCC44_X64_VFRPP_PATH = DEF(GCC44_X64_PREFIX)gcc
@@ -4602,7 +4602,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC44_X64_RC_PATH = DEF(GCC44_X64_PREFIX)objcopy

*_GCC44_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC44_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC44_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_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)
@@ -4637,8 +4637,8 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC45_IA32_OBJCOPY_PATH = DEF(GCC45_IA32_PREFIX)objcopy
*_GCC45_IA32_CC_PATH = DEF(GCC45_IA32_PREFIX)gcc
*_GCC45_IA32_SLINK_PATH = DEF(GCC45_IA32_PREFIX)ar
-*_GCC45_IA32_DLINK_PATH = DEF(GCC45_IA32_PREFIX)ld
-*_GCC45_IA32_ASLDLINK_PATH = DEF(GCC45_IA32_PREFIX)ld
+*_GCC45_IA32_DLINK_PATH = DEF(GCC45_IA32_PREFIX)gcc
+*_GCC45_IA32_ASLDLINK_PATH = DEF(GCC45_IA32_PREFIX)gcc
*_GCC45_IA32_ASM_PATH = DEF(GCC45_IA32_PREFIX)gcc
*_GCC45_IA32_PP_PATH = DEF(GCC45_IA32_PREFIX)gcc
*_GCC45_IA32_VFRPP_PATH = DEF(GCC45_IA32_PREFIX)gcc
@@ -4647,10 +4647,10 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC45_IA32_RC_PATH = DEF(GCC45_IA32_PREFIX)objcopy

*_GCC45_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC45_IA32_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC45_IA32_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_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_DLINK_FLAGS = DEF(GCC45_IA32_X64_DLINK_FLAGS) -Wl,-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 =
@@ -4662,8 +4662,8 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC45_X64_OBJCOPY_PATH = DEF(GCC45_X64_PREFIX)objcopy
*_GCC45_X64_CC_PATH = DEF(GCC45_X64_PREFIX)gcc
*_GCC45_X64_SLINK_PATH = DEF(GCC45_X64_PREFIX)ar
-*_GCC45_X64_DLINK_PATH = DEF(GCC45_X64_PREFIX)ld
-*_GCC45_X64_ASLDLINK_PATH = DEF(GCC45_X64_PREFIX)ld
+*_GCC45_X64_DLINK_PATH = DEF(GCC45_X64_PREFIX)gcc
+*_GCC45_X64_ASLDLINK_PATH = DEF(GCC45_X64_PREFIX)gcc
*_GCC45_X64_ASM_PATH = DEF(GCC45_X64_PREFIX)gcc
*_GCC45_X64_PP_PATH = DEF(GCC45_X64_PREFIX)gcc
*_GCC45_X64_VFRPP_PATH = DEF(GCC45_X64_PREFIX)gcc
@@ -4672,7 +4672,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC45_X64_RC_PATH = DEF(GCC45_X64_PREFIX)objcopy

*_GCC45_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC45_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC45_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_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)
@@ -4707,8 +4707,8 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC46_IA32_OBJCOPY_PATH = DEF(GCC46_IA32_PREFIX)objcopy
*_GCC46_IA32_CC_PATH = DEF(GCC46_IA32_PREFIX)gcc
*_GCC46_IA32_SLINK_PATH = DEF(GCC46_IA32_PREFIX)ar
-*_GCC46_IA32_DLINK_PATH = DEF(GCC46_IA32_PREFIX)ld
-*_GCC46_IA32_ASLDLINK_PATH = DEF(GCC46_IA32_PREFIX)ld
+*_GCC46_IA32_DLINK_PATH = DEF(GCC46_IA32_PREFIX)gcc
+*_GCC46_IA32_ASLDLINK_PATH = DEF(GCC46_IA32_PREFIX)gcc
*_GCC46_IA32_ASM_PATH = DEF(GCC46_IA32_PREFIX)gcc
*_GCC46_IA32_PP_PATH = DEF(GCC46_IA32_PREFIX)gcc
*_GCC46_IA32_VFRPP_PATH = DEF(GCC46_IA32_PREFIX)gcc
@@ -4717,9 +4717,9 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
*_GCC46_IA32_RC_PATH = DEF(GCC46_IA32_PREFIX)objcopy

*_GCC46_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC46_IA32_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC46_IA32_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_GCC46_IA32_ASM_FLAGS = DEF(GCC46_ASM_FLAGS) -m32 -march=i386
-*_GCC46_IA32_DLINK_FLAGS = DEF(GCC46_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC46_IA32_DLINK_FLAGS = DEF(GCC46_IA32_X64_DLINK_FLAGS) -Wl,-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 =
@@ -4734,8 +4734,8 @@ RELEASE_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC46_X64_OBJCOPY_PATH = DEF(GCC46_X64_PREFIX)objcopy
*_GCC46_X64_CC_PATH = DEF(GCC46_X64_PREFIX)gcc
*_GCC46_X64_SLINK_PATH = DEF(GCC46_X64_PREFIX)ar
-*_GCC46_X64_DLINK_PATH = DEF(GCC46_X64_PREFIX)ld
-*_GCC46_X64_ASLDLINK_PATH = DEF(GCC46_X64_PREFIX)ld
+*_GCC46_X64_DLINK_PATH = DEF(GCC46_X64_PREFIX)gcc
+*_GCC46_X64_ASLDLINK_PATH = DEF(GCC46_X64_PREFIX)gcc
*_GCC46_X64_ASM_PATH = DEF(GCC46_X64_PREFIX)gcc
*_GCC46_X64_PP_PATH = DEF(GCC46_X64_PREFIX)gcc
*_GCC46_X64_VFRPP_PATH = DEF(GCC46_X64_PREFIX)gcc
@@ -4744,7 +4744,7 @@ RELEASE_GCC46_IA32_CC_FLAGS = DEF(GCC46_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC46_X64_RC_PATH = DEF(GCC46_X64_PREFIX)objcopy

*_GCC46_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC46_X64_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC46_X64_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_GCC46_X64_ASM_FLAGS = DEF(GCC46_ASM_FLAGS) -m64 -melf_x86_64
*_GCC46_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
*_GCC46_X64_DLINK2_FLAGS = DEF(GCC46_X64_DLINK2_FLAGS)
@@ -4761,8 +4761,8 @@ RELEASE_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) -Wno-unused-but-set-v
*_GCC46_ARM_OBJCOPY_PATH = echo
*_GCC46_ARM_CC_PATH = ENV(GCC46_ARM_PREFIX)gcc
*_GCC46_ARM_SLINK_PATH = ENV(GCC46_ARM_PREFIX)ar
-*_GCC46_ARM_DLINK_PATH = ENV(GCC46_ARM_PREFIX)ld
-*_GCC46_ARM_ASLDLINK_PATH = ENV(GCC46_ARM_PREFIX)ld
+*_GCC46_ARM_DLINK_PATH = ENV(GCC46_ARM_PREFIX)gcc
+*_GCC46_ARM_ASLDLINK_PATH = ENV(GCC46_ARM_PREFIX)gcc
*_GCC46_ARM_ASM_PATH = ENV(GCC46_ARM_PREFIX)gcc
*_GCC46_ARM_PP_PATH = ENV(GCC46_ARM_PREFIX)gcc
*_GCC46_ARM_VFRPP_PATH = ENV(GCC46_ARM_PREFIX)gcc
@@ -4812,8 +4812,8 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -D__ARM_FEATURE_UNALI
*_GCC47_IA32_OBJCOPY_PATH = DEF(GCC47_IA32_PREFIX)objcopy
*_GCC47_IA32_CC_PATH = DEF(GCC47_IA32_PREFIX)gcc
*_GCC47_IA32_SLINK_PATH = DEF(GCC47_IA32_PREFIX)ar
-*_GCC47_IA32_DLINK_PATH = DEF(GCC47_IA32_PREFIX)ld
-*_GCC47_IA32_ASLDLINK_PATH = DEF(GCC47_IA32_PREFIX)ld
+*_GCC47_IA32_DLINK_PATH = DEF(GCC47_IA32_PREFIX)gcc
+*_GCC47_IA32_ASLDLINK_PATH = DEF(GCC47_IA32_PREFIX)gcc
*_GCC47_IA32_ASM_PATH = DEF(GCC47_IA32_PREFIX)gcc
*_GCC47_IA32_PP_PATH = DEF(GCC47_IA32_PREFIX)gcc
*_GCC47_IA32_VFRPP_PATH = DEF(GCC47_IA32_PREFIX)gcc
@@ -4822,9 +4822,9 @@ RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -D__ARM_FEATURE_UNALI
*_GCC47_IA32_RC_PATH = DEF(GCC47_IA32_PREFIX)objcopy

*_GCC47_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC47_IA32_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC47_IA32_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_GCC47_IA32_ASM_FLAGS = DEF(GCC47_ASM_FLAGS) -m32 -march=i386
-*_GCC47_IA32_DLINK_FLAGS = DEF(GCC47_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC47_IA32_DLINK_FLAGS = DEF(GCC47_IA32_X64_DLINK_FLAGS) -Wl,-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 =
@@ -4839,8 +4839,8 @@ RELEASE_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC47_X64_OBJCOPY_PATH = DEF(GCC47_X64_PREFIX)objcopy
*_GCC47_X64_CC_PATH = DEF(GCC47_X64_PREFIX)gcc
*_GCC47_X64_SLINK_PATH = DEF(GCC47_X64_PREFIX)ar
-*_GCC47_X64_DLINK_PATH = DEF(GCC47_X64_PREFIX)ld
-*_GCC47_X64_ASLDLINK_PATH = DEF(GCC47_X64_PREFIX)ld
+*_GCC47_X64_DLINK_PATH = DEF(GCC47_X64_PREFIX)gcc
+*_GCC47_X64_ASLDLINK_PATH = DEF(GCC47_X64_PREFIX)gcc
*_GCC47_X64_ASM_PATH = DEF(GCC47_X64_PREFIX)gcc
*_GCC47_X64_PP_PATH = DEF(GCC47_X64_PREFIX)gcc
*_GCC47_X64_VFRPP_PATH = DEF(GCC47_X64_PREFIX)gcc
@@ -4849,7 +4849,7 @@ RELEASE_GCC47_IA32_CC_FLAGS = DEF(GCC47_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC47_X64_RC_PATH = DEF(GCC47_X64_PREFIX)objcopy

*_GCC47_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC47_X64_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC47_X64_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_GCC47_X64_ASM_FLAGS = DEF(GCC47_ASM_FLAGS) -m64
*_GCC47_X64_DLINK_FLAGS = DEF(GCC47_X64_DLINK_FLAGS)
*_GCC47_X64_DLINK2_FLAGS = DEF(GCC47_X64_DLINK2_FLAGS)
@@ -4865,8 +4865,8 @@ RELEASE_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC47_ARM_CC_PATH = ENV(GCC47_ARM_PREFIX)gcc
*_GCC47_ARM_SLINK_PATH = ENV(GCC47_ARM_PREFIX)ar
-*_GCC47_ARM_DLINK_PATH = ENV(GCC47_ARM_PREFIX)ld
-*_GCC47_ARM_ASLDLINK_PATH = ENV(GCC47_ARM_PREFIX)ld
+*_GCC47_ARM_DLINK_PATH = ENV(GCC47_ARM_PREFIX)gcc
+*_GCC47_ARM_ASLDLINK_PATH = ENV(GCC47_ARM_PREFIX)gcc
*_GCC47_ARM_ASM_PATH = ENV(GCC47_ARM_PREFIX)gcc
*_GCC47_ARM_PP_PATH = ENV(GCC47_ARM_PREFIX)gcc
*_GCC47_ARM_VFRPP_PATH = ENV(GCC47_ARM_PREFIX)gcc
@@ -4895,8 +4895,8 @@ RELEASE_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC47_AARCH64_CC_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
*_GCC47_AARCH64_SLINK_PATH = ENV(GCC47_AARCH64_PREFIX)ar
-*_GCC47_AARCH64_DLINK_PATH = ENV(GCC47_AARCH64_PREFIX)ld
-*_GCC47_AARCH64_ASLDLINK_PATH = ENV(GCC47_AARCH64_PREFIX)ld
+*_GCC47_AARCH64_DLINK_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
+*_GCC47_AARCH64_ASLDLINK_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
*_GCC47_AARCH64_ASM_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
*_GCC47_AARCH64_PP_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
*_GCC47_AARCH64_VFRPP_PATH = ENV(GCC47_AARCH64_PREFIX)gcc
@@ -4944,8 +4944,8 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC48_IA32_OBJCOPY_PATH = DEF(GCC48_IA32_PREFIX)objcopy
*_GCC48_IA32_CC_PATH = DEF(GCC48_IA32_PREFIX)gcc
*_GCC48_IA32_SLINK_PATH = DEF(GCC48_IA32_PREFIX)ar
-*_GCC48_IA32_DLINK_PATH = DEF(GCC48_IA32_PREFIX)ld
-*_GCC48_IA32_ASLDLINK_PATH = DEF(GCC48_IA32_PREFIX)ld
+*_GCC48_IA32_DLINK_PATH = DEF(GCC48_IA32_PREFIX)gcc
+*_GCC48_IA32_ASLDLINK_PATH = DEF(GCC48_IA32_PREFIX)gcc
*_GCC48_IA32_ASM_PATH = DEF(GCC48_IA32_PREFIX)gcc
*_GCC48_IA32_PP_PATH = DEF(GCC48_IA32_PREFIX)gcc
*_GCC48_IA32_VFRPP_PATH = DEF(GCC48_IA32_PREFIX)gcc
@@ -4954,9 +4954,9 @@ RELEASE_GCC47_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC48_IA32_RC_PATH = DEF(GCC48_IA32_PREFIX)objcopy

*_GCC48_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC48_IA32_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC48_IA32_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_GCC48_IA32_ASM_FLAGS = DEF(GCC48_ASM_FLAGS) -m32 -march=i386
-*_GCC48_IA32_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC48_IA32_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_FLAGS) -Wl,-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 =
@@ -4971,8 +4971,8 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC48_X64_OBJCOPY_PATH = DEF(GCC48_X64_PREFIX)objcopy
*_GCC48_X64_CC_PATH = DEF(GCC48_X64_PREFIX)gcc
*_GCC48_X64_SLINK_PATH = DEF(GCC48_X64_PREFIX)ar
-*_GCC48_X64_DLINK_PATH = DEF(GCC48_X64_PREFIX)ld
-*_GCC48_X64_ASLDLINK_PATH = DEF(GCC48_X64_PREFIX)ld
+*_GCC48_X64_DLINK_PATH = DEF(GCC48_X64_PREFIX)gcc
+*_GCC48_X64_ASLDLINK_PATH = DEF(GCC48_X64_PREFIX)gcc
*_GCC48_X64_ASM_PATH = DEF(GCC48_X64_PREFIX)gcc
*_GCC48_X64_PP_PATH = DEF(GCC48_X64_PREFIX)gcc
*_GCC48_X64_VFRPP_PATH = DEF(GCC48_X64_PREFIX)gcc
@@ -4981,7 +4981,7 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC48_X64_RC_PATH = DEF(GCC48_X64_PREFIX)objcopy

*_GCC48_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC48_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC48_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_GCC48_X64_ASM_FLAGS = DEF(GCC48_ASM_FLAGS) -m64
*_GCC48_X64_DLINK_FLAGS = DEF(GCC48_X64_DLINK_FLAGS)
*_GCC48_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS)
@@ -4997,8 +4997,8 @@ RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC48_ARM_CC_PATH = ENV(GCC48_ARM_PREFIX)gcc
*_GCC48_ARM_SLINK_PATH = ENV(GCC48_ARM_PREFIX)ar
-*_GCC48_ARM_DLINK_PATH = ENV(GCC48_ARM_PREFIX)ld
-*_GCC48_ARM_ASLDLINK_PATH = ENV(GCC48_ARM_PREFIX)ld
+*_GCC48_ARM_DLINK_PATH = ENV(GCC48_ARM_PREFIX)gcc
+*_GCC48_ARM_ASLDLINK_PATH = ENV(GCC48_ARM_PREFIX)gcc
*_GCC48_ARM_ASM_PATH = ENV(GCC48_ARM_PREFIX)gcc
*_GCC48_ARM_PP_PATH = ENV(GCC48_ARM_PREFIX)gcc
*_GCC48_ARM_VFRPP_PATH = ENV(GCC48_ARM_PREFIX)gcc
@@ -5027,8 +5027,8 @@ RELEASE_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC48_AARCH64_CC_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
*_GCC48_AARCH64_SLINK_PATH = ENV(GCC48_AARCH64_PREFIX)ar
-*_GCC48_AARCH64_DLINK_PATH = ENV(GCC48_AARCH64_PREFIX)ld
-*_GCC48_AARCH64_ASLDLINK_PATH = ENV(GCC48_AARCH64_PREFIX)ld
+*_GCC48_AARCH64_DLINK_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
+*_GCC48_AARCH64_ASLDLINK_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
*_GCC48_AARCH64_ASM_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
*_GCC48_AARCH64_PP_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
*_GCC48_AARCH64_VFRPP_PATH = ENV(GCC48_AARCH64_PREFIX)gcc
@@ -5076,8 +5076,8 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC49_IA32_OBJCOPY_PATH = DEF(GCC49_IA32_PREFIX)objcopy
*_GCC49_IA32_CC_PATH = DEF(GCC49_IA32_PREFIX)gcc
*_GCC49_IA32_SLINK_PATH = DEF(GCC49_IA32_PREFIX)ar
-*_GCC49_IA32_DLINK_PATH = DEF(GCC49_IA32_PREFIX)ld
-*_GCC49_IA32_ASLDLINK_PATH = DEF(GCC49_IA32_PREFIX)ld
+*_GCC49_IA32_DLINK_PATH = DEF(GCC49_IA32_PREFIX)gcc
+*_GCC49_IA32_ASLDLINK_PATH = DEF(GCC49_IA32_PREFIX)gcc
*_GCC49_IA32_ASM_PATH = DEF(GCC49_IA32_PREFIX)gcc
*_GCC49_IA32_PP_PATH = DEF(GCC49_IA32_PREFIX)gcc
*_GCC49_IA32_VFRPP_PATH = DEF(GCC49_IA32_PREFIX)gcc
@@ -5086,9 +5086,9 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC49_IA32_RC_PATH = DEF(GCC49_IA32_PREFIX)objcopy

*_GCC49_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC49_IA32_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
+*_GCC49_IA32_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
*_GCC49_IA32_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) -m32 -march=i386
-*_GCC49_IA32_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
+*_GCC49_IA32_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -Wl,-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 =
@@ -5103,8 +5103,8 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC49_X64_OBJCOPY_PATH = DEF(GCC49_X64_PREFIX)objcopy
*_GCC49_X64_CC_PATH = DEF(GCC49_X64_PREFIX)gcc
*_GCC49_X64_SLINK_PATH = DEF(GCC49_X64_PREFIX)ar
-*_GCC49_X64_DLINK_PATH = DEF(GCC49_X64_PREFIX)ld
-*_GCC49_X64_ASLDLINK_PATH = DEF(GCC49_X64_PREFIX)ld
+*_GCC49_X64_DLINK_PATH = DEF(GCC49_X64_PREFIX)gcc
+*_GCC49_X64_ASLDLINK_PATH = DEF(GCC49_X64_PREFIX)gcc
*_GCC49_X64_ASM_PATH = DEF(GCC49_X64_PREFIX)gcc
*_GCC49_X64_PP_PATH = DEF(GCC49_X64_PREFIX)gcc
*_GCC49_X64_VFRPP_PATH = DEF(GCC49_X64_PREFIX)gcc
@@ -5113,7 +5113,7 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC49_X64_RC_PATH = DEF(GCC49_X64_PREFIX)objcopy

*_GCC49_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC49_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -m elf_x86_64
+*_GCC49_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
*_GCC49_X64_ASM_FLAGS = DEF(GCC49_ASM_FLAGS) -m64
*_GCC49_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS)
*_GCC49_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS)
@@ -5129,8 +5129,8 @@ RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC49_ARM_CC_PATH = ENV(GCC49_ARM_PREFIX)gcc
*_GCC49_ARM_SLINK_PATH = ENV(GCC49_ARM_PREFIX)ar
-*_GCC49_ARM_DLINK_PATH = ENV(GCC49_ARM_PREFIX)ld
-*_GCC49_ARM_ASLDLINK_PATH = ENV(GCC49_ARM_PREFIX)ld
+*_GCC49_ARM_DLINK_PATH = ENV(GCC49_ARM_PREFIX)gcc
+*_GCC49_ARM_ASLDLINK_PATH = ENV(GCC49_ARM_PREFIX)gcc
*_GCC49_ARM_ASM_PATH = ENV(GCC49_ARM_PREFIX)gcc
*_GCC49_ARM_PP_PATH = ENV(GCC49_ARM_PREFIX)gcc
*_GCC49_ARM_VFRPP_PATH = ENV(GCC49_ARM_PREFIX)gcc
@@ -5159,8 +5159,8 @@ RELEASE_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-v
##################
*_GCC49_AARCH64_CC_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
*_GCC49_AARCH64_SLINK_PATH = ENV(GCC49_AARCH64_PREFIX)ar
-*_GCC49_AARCH64_DLINK_PATH = ENV(GCC49_AARCH64_PREFIX)ld
-*_GCC49_AARCH64_ASLDLINK_PATH = ENV(GCC49_AARCH64_PREFIX)ld
+*_GCC49_AARCH64_DLINK_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
+*_GCC49_AARCH64_ASLDLINK_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
*_GCC49_AARCH64_ASM_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
*_GCC49_AARCH64_PP_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
*_GCC49_AARCH64_VFRPP_PATH = ENV(GCC49_AARCH64_PREFIX)gcc
@@ -5209,9 +5209,11 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS)
*_CLANG35_*_VFRPP_PATH = ENV(CLANG35_BIN)clang
*_CLANG35_*_ASLCC_PATH = ENV(CLANG35_BIN)clang
*_CLANG35_*_ASLPP_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_DLINK_PATH = ENV(CLANG35_BIN)clang
+*_CLANG35_*_ASLDLINK_PATH = ENV(CLANG35_BIN)clang

-DEFINE CLANG35_ARM_TARGET = -target armv7-none-linux-gnueabi
-DEFINE CLANG35_AARCH64_TARGET = -target aarch64-none-linux-gnu
+DEFINE CLANG35_ARM_TARGET = -target arm-linux-gnueabihf
+DEFINE CLANG35_AARCH64_TARGET = -target aarch64-linux-gnu

DEFINE CLANG35_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body
DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) -mstrict-align DEF(CLANG35_WARNING_OVERRIDES)
@@ -5221,15 +5223,13 @@ DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64
# CLANG35 ARM definitions
##################
*_CLANG35_ARM_SLINK_PATH = ENV(CLANG35_ARM_PREFIX)ar
-*_CLANG35_ARM_DLINK_PATH = ENV(CLANG35_ARM_PREFIX)ld
-*_CLANG35_ARM_ASLDLINK_PATH = ENV(CLANG35_ARM_PREFIX)ld
*_CLANG35_ARM_RC_PATH = ENV(CLANG35_ARM_PREFIX)objcopy

*_CLANG35_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
-*_CLANG35_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS)
+*_CLANG35_ARM_ASLDLINK_FLAGS = DEF(CLANG35_ARM_TARGET) DEF(GCC_ARM_ASLDLINK_FLAGS)
*_CLANG35_ARM_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments
-*_CLANG35_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS)
-*_CLANG35_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x220
+*_CLANG35_ARM_DLINK_FLAGS = DEF(CLANG35_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)
+*_CLANG35_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
*_CLANG35_ARM_PLATFORM_FLAGS =
*_CLANG35_ARM_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
*_CLANG35_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
@@ -5243,15 +5243,13 @@ RELEASE_CLANG35_ARM_CC_FLAGS = DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(P
# CLANG35 AARCH64 definitions
##################
*_CLANG35_AARCH64_SLINK_PATH = ENV(CLANG35_AARCH64_PREFIX)ar
-*_CLANG35_AARCH64_DLINK_PATH = ENV(CLANG35_AARCH64_PREFIX)ld
-*_CLANG35_AARCH64_ASLDLINK_PATH = ENV(CLANG35_AARCH64_PREFIX)ld
*_CLANG35_AARCH64_RC_PATH = ENV(CLANG35_AARCH64_PREFIX)objcopy

*_CLANG35_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
-*_CLANG35_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_ASLDLINK_FLAGS)
+*_CLANG35_AARCH64_ASLDLINK_FLAGS = DEF(CLANG35_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS)
*_CLANG35_AARCH64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG35_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments
-*_CLANG35_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
-*_CLANG35_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) --defsym=PECOFF_HEADER_SIZE=0x228
+*_CLANG35_AARCH64_DLINK_FLAGS = DEF(CLANG35_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
+*_CLANG35_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
*_CLANG35_AARCH64_PLATFORM_FLAGS =
*_CLANG35_AARCH64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG35_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
*_CLANG35_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS)
diff --git a/EmulatorPkg/Unix/Host/Host.inf b/EmulatorPkg/Unix/Host/Host.inf
index d0b4927d1678..d83857a1fd68 100644
--- a/EmulatorPkg/Unix/Host/Host.inf
+++ b/EmulatorPkg/Unix/Host/Host.inf
@@ -116,12 +116,12 @@ [FeaturePcd]


[BuildOptions]
- GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/Host -m elf_i386 -dynamic-linker $(HOST_DLINK_PATHS) -L/usr/lib/i386-linux-gnu -L/usr/X11R6/lib -lXext -lX11
+ GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/Host -m32 -L/usr/X11R6/lib
GCC:*_*_IA32_CC_FLAGS == -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
GCC:*_*_IA32_PP_FLAGS == -m32 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
GCC:*_*_IA32_ASM_FLAGS == -m32 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h

- GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/Host -m elf_x86_64 -dynamic-linker $(HOST_DLINK_PATHS) -L/usr/lib/x86_64-linux-gnu -L/usr/X11R6/lib -lXext -lX11
+ GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/Host -m64 -L/usr/X11R6/lib
GCC:*_*_X64_CC_FLAGS == -m64 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
GCC:*_GCC44_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
GCC:*_GCC45_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
@@ -132,7 +132,7 @@ [BuildOptions]
GCC:*_*_X64_PP_FLAGS == -m64 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
GCC:*_*_X64_ASM_FLAGS == -m64 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h

- GCC:*_*_*_DLINK2_FLAGS == -lpthread -lc -ldl
+ GCC:*_*_*_DLINK2_FLAGS == -lpthread -ldl -lXext -lX11

#
# Need to do this link via gcc and not ld as the pathing to libraries changes from OS version to OS version
--
2.7.4

Join devel@edk2.groups.io to automatically receive all group messages.