* [PATCH v5 1/8] BaseTools CLANG35: drop problematic use-movt and save-temps options
2016-08-01 8:01 [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode Ard Biesheuvel
@ 2016-08-01 8:01 ` Ard Biesheuvel
2016-08-01 8:01 ` [PATCH v5 2/8] ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note sections Ard Biesheuvel
` (8 subsequent siblings)
9 siblings, 0 replies; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 8:01 UTC (permalink / raw)
To: steven.shi, yonghong.zhu, liming.gao, jordan.l.justen, edk2-devel
Cc: leif.lindholm, lersek, Ard Biesheuvel
Some versions of Clang fail on every input file when using the
-save-temps options, and produces the following heplful error message:
<unknown>:0: error: Undefined temporary symbol
Simply dropping the option for CLANG35 is the simplest way around this,
since the value of storing .i and .s files is dubious anyway.
Also, drop the arm-use-movt option, which does not appear to be
supported anymore by recent versions of clang.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
---
BaseTools/Conf/tools_def.template | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 847b9f729f29..b36a19314215 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4325,8 +4325,8 @@ DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -
DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe
DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency
-DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -save-temps -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
-DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -save-temps -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables
+DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
+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
@@ -4384,7 +4384,7 @@ 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 -mword-relocations
+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
@@ -4401,7 +4401,7 @@ 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
DEFINE GCC47_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -mno-unaligned-access
-DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
+DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS) -save-temps
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)
@@ -4443,7 +4443,7 @@ 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)
DEFINE GCC49_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS)
-DEFINE GCC49_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS)
+DEFINE GCC49_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -save-temps
DEFINE GCC49_AARCH64_CC_XIPFLAGS = DEF(GCC48_AARCH64_CC_XIPFLAGS)
DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
DEFINE GCC49_ARM_DLINK2_FLAGS = DEF(GCC48_ARM_DLINK2_FLAGS)
@@ -5213,7 +5213,7 @@ DEFINE CLANG35_ARM_TARGET = -target armv7-none-linux-gnueabi
DEFINE CLANG35_AARCH64_TARGET = -target aarch64-none-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 -mllvm -arm-use-movt=0 DEF(CLANG35_WARNING_OVERRIDES)
+DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) -mstrict-align DEF(CLANG35_WARNING_OVERRIDES)
DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64_TARGET) -mcmodel=small DEF(CLANG35_WARNING_OVERRIDES)
##################
--
2.7.4
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 2/8] ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note sections
2016-08-01 8:01 [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode Ard Biesheuvel
2016-08-01 8:01 ` [PATCH v5 1/8] BaseTools CLANG35: drop problematic use-movt and save-temps options Ard Biesheuvel
@ 2016-08-01 8:01 ` Ard Biesheuvel
2016-08-01 8:01 ` [PATCH v5 3/8] BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into GCCLD Ard Biesheuvel
` (7 subsequent siblings)
9 siblings, 0 replies; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 8:01 UTC (permalink / raw)
To: steven.shi, yonghong.zhu, liming.gao, jordan.l.justen, edk2-devel
Cc: leif.lindholm, lersek, Ard Biesheuvel
Newer versions of ld automatically emit .gnu.hash and .note.gnu.build-id
sections, which are not listed in the linker script, and will end up
breaking the build with an allocation conflict, e.g.,
/usr/bin/aarch64-linux-gnu-ld: section .note.gnu.build-id loaded at
[0000000000000000,0000000000000023] overlaps section .text loaded at
[0000000000000000,0000000000017dbf]
Since we don't require or care about these sections, update the linker
script so that they are discarded. Note that this involves emitting the
.note.gnu.build-id section into a non-allocatable segment to prevent the
linker from noticing that it is being discarded (and subsequently
complaining about it)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
---
ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds b/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds
index 832ad1474468..44df7840adfd 100644
--- a/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds
+++ b/ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds
@@ -30,8 +30,11 @@ SECTIONS
PROVIDE(__reloc_end = .);
}
+ .note (INFO) : { *(.note.gnu.build-id) }
+
/DISCARD/ : {
*(.note.GNU-stack)
+ *(.gnu.hash)
*(.gnu_debuglink)
*(.interp)
*(.dynamic)
--
2.7.4
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 3/8] BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into GCCLD
2016-08-01 8:01 [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode Ard Biesheuvel
2016-08-01 8:01 ` [PATCH v5 1/8] BaseTools CLANG35: drop problematic use-movt and save-temps options Ard Biesheuvel
2016-08-01 8:01 ` [PATCH v5 2/8] ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note sections Ard Biesheuvel
@ 2016-08-01 8:01 ` Ard Biesheuvel
2016-08-01 8:01 ` [PATCH v5 4/8] BaseTools GCC: use 'gcc' as the linker command for GCC44 and later Ard Biesheuvel
` (6 subsequent siblings)
9 siblings, 0 replies; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 8:01 UTC (permalink / raw)
To: steven.shi, yonghong.zhu, liming.gao, jordan.l.justen, edk2-devel
Cc: leif.lindholm, lersek, Ard Biesheuvel
Before we can make non-backward compatible changes to the GCC build rules
regarding the use of the 'gcc' binary as the linker, clone the existing
GCC build rules into a 'GCCLD' build rule family, and move the legacy
toolchains UNIXGCC, CYGGCC, CYGGCCxASL and ELFGCC over to it.
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>
---
BaseTools/Conf/build_rule.template | 28 ++++++++++----------
BaseTools/Conf/tools_def.template | 4 +++
2 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template
index 91bcc1828cb5..3fea4f456118 100644
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -130,7 +130,7 @@
<Command.MSFT, Command.INTEL>
"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
- <Command.GCC, Command.RVCT>
+ <Command.GCC, Command.GCCLD, Command.RVCT>
# For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
@@ -156,7 +156,7 @@
<Command.MSFT, Command.INTEL>
"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
- <Command.GCC, Command.RVCT>
+ <Command.GCC, Command.GCCLD, Command.RVCT>
# For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
"$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst}
@@ -171,7 +171,7 @@
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(CC)" $(CC_FLAGS) $(CC_XIPFLAGS) -o ${dst} $(INC) ${src}
[C-Header-File]
@@ -187,7 +187,7 @@
<InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
?.asm, ?.Asm, ?.ASM
- <InputFile.GCC>
+ <InputFile.GCC, InputFile.GCCLD>
?.S, ?.s
<ExtraDependency>
@@ -201,7 +201,7 @@
Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
- <Command.GCC, Command.RVCT>
+ <Command.GCC, Command.GCCLD, Command.RVCT>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
@@ -265,7 +265,7 @@
<Command.MSFT, Command.INTEL>
"$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} @$(OBJECT_FILES_LIST)
- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(SLINK)" -cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
<Command.RVCT>
@@ -291,7 +291,7 @@
<Command.MSFT, Command.INTEL>
"$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
- <Command.GCC>
+ <Command.GCC, 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 +319,7 @@
<Command.MSFT, Command.INTEL>
"$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(DLINK)" $(DLINK_FLAGS) --start-group $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)
<Command.RVCT>
@@ -346,7 +346,7 @@
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
-$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR)
- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
$(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
$(OBJCOPY) --strip-unneeded -R .eh_frame ${src}
@@ -402,7 +402,7 @@
Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
"$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii
- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
"$(ASLPP)" $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
@@ -423,7 +423,7 @@
"$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
@@ -443,7 +443,7 @@
"$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
@@ -472,7 +472,7 @@
"$(ASM16)" /nologo /c /omf $(INC) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${d_path}(+)${s_base}.iii
"$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
@@ -596,7 +596,7 @@
"$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiipackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
"$(RC)" /Fo${dst} $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc
- <Command.GCC>
+ <Command.GCC, Command.GCCLD>
"$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
"$(RC)" $(RC_FLAGS) $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc ${dst}
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index b36a19314215..8a04e38e1288 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4460,6 +4460,7 @@ DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
# UNIXGCC - UNIX GCC
# ASL - Intel Linux ACPI Source Language Compiler (iasl)
*_UNIXGCC_*_*_FAMILY = GCC
+*_UNIXGCC_*_*_BUILDRULEFAMILY = GCCLD
*_UNIXGCC_*_MAKE_PATH = make
*_UNIXGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN)
@@ -5268,6 +5269,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
# CYGGCC - CygWin GCC
# ASL - Intel ACPI Source Language Compiler (iasl.exe)
*_CYGGCC_*_*_FAMILY = GCC
+*_CYGGCC_*_*_BUILDRULEFAMILY = GCCLD
*_CYGGCC_*_*_DLL = DEF(CYGWIN_BIN)
*_CYGGCC_*_MAKE_PATH = DEF(MS_VS_BIN)\nmake.exe
@@ -5375,6 +5377,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
# CYGGCCxASL - CygWin GCC
# ASL - Microsoft ACPI Source Language Compiler (asl.exe)
*_CYGGCCxASL_*_*_FAMILY = GCC
+*_CYGGCCxASL_*_*_BUILDRULEFAMILY = GCCLD
*_CYGGCCxASL_*_*_DLL = DEF(CYGWIN_BIN)
*_CYGGCCxASL_*_MAKE_PATH = DEF(MS_VS_BIN)\nmake.exe
@@ -5478,6 +5481,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
####################################################################################
# ELFGCC - Linux ELF GCC
*_ELFGCC_*_*_FAMILY = GCC
+*_ELFGCC_*_*_BUILDRULEFAMILY = GCCLD
*_ELFGCC_*_MAKE_PATH = make
*_ELFGCC_*_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h
--
2.7.4
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 4/8] BaseTools GCC: use 'gcc' as the linker command for GCC44 and later
2016-08-01 8:01 [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode Ard Biesheuvel
` (2 preceding siblings ...)
2016-08-01 8:01 ` [PATCH v5 3/8] BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into GCCLD Ard Biesheuvel
@ 2016-08-01 8:01 ` Ard Biesheuvel
2016-08-01 8:01 ` [PATCH v5 5/8] ArmPkg: add prebuilt glue binaries for GCC5 LTO support Ard Biesheuvel
` (5 subsequent siblings)
9 siblings, 0 replies; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 8:01 UTC (permalink / raw)
To: steven.shi, yonghong.zhu, liming.gao, jordan.l.justen, edk2-devel
Cc: leif.lindholm, lersek, 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
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 5/8] ArmPkg: add prebuilt glue binaries for GCC5 LTO support
2016-08-01 8:01 [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode Ard Biesheuvel
` (3 preceding siblings ...)
2016-08-01 8:01 ` [PATCH v5 4/8] BaseTools GCC: use 'gcc' as the linker command for GCC44 and later Ard Biesheuvel
@ 2016-08-01 8:01 ` Ard Biesheuvel
2016-08-02 8:50 ` Leif Lindholm
2016-08-01 8:01 ` [PATCH v5 6/8] BaseTools GCC: drop GNU notes section from EFI image Ard Biesheuvel
` (4 subsequent siblings)
9 siblings, 1 reply; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 8:01 UTC (permalink / raw)
To: steven.shi, yonghong.zhu, liming.gao, jordan.l.justen, edk2-devel
Cc: leif.lindholm, lersek, Ard Biesheuvel
GCC in LTO mode interoperates poorly with non-standard libraries that
provide implementations of compiler intrinsics such as memcpy/memset
or the stack protector entry points. Such libraries need to be built
in non-LTO mode, and then referenced explicitly on the linker command
line using a -plugin-opt=-pass-through=-lxxx linker option.
However, if these intrinsics are also referenced directly, the LTO
version of the code will be pulled in, and will happily satisfy all
other references to the same symbol.
So add a pair of glue libraries, for ARM and AARCH64, that reference
the known intrinsics. Since the binaries live under ArmPkg directly,
we can reference them in tools_def.txt. Under LD garbage collection,
the object itself will be pruned, and so will the intrinsics that end
up unused by the module.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
---
ArmPkg/Library/GccLto/liblto-aarch64.a | Bin 0 -> 1016 bytes
ArmPkg/Library/GccLto/liblto-aarch64.s | 27 +++++++++
ArmPkg/Library/GccLto/liblto-arm.a | Bin 0 -> 2096 bytes
ArmPkg/Library/GccLto/liblto-arm.s | 61 ++++++++++++++++++++
4 files changed, 88 insertions(+)
diff --git a/ArmPkg/Library/GccLto/liblto-aarch64.a b/ArmPkg/Library/GccLto/liblto-aarch64.a
new file mode 100644
index 0000000000000000000000000000000000000000..2ab00238f0dad882abf08a1fb9623c9cdea9f17b
GIT binary patch
literal 1016
zcmbu7&rZTX5XPqz6oLo!M8btcV>pmaJb3R#Pab@Ovb0qUG$GwJk&}<*)yMErJh~su
zhGA(FBh#ci^V@G{X8(NLKR&dgh`dGgNxR5Xq8|a14Nj;_ot@whUR;}*D0W|+#ne8)
z+crcqtbp?TKuy$d;Fk^js)5sWPGwPMt2G8wSV~i4b+$;e`67MRugg8~@}{d?w$pJf
z%hU2Z13wYMF8ko8f}aWQH5;VNy0m&m%Ghc<&b?O^ORa42Zb{|ZYEm;}M9QPwkz0*h
zki8>ef}gYSE})e*bOFvFk<j^57EYNXKak(^fcXvc@Z~)5d^m*lCr*Hz|6PAkvlcbK
oxX>*EVPSp5Eivz1-~TrQyaBwMaQ{8W!rrlD%!Td{2n*}~0;u;a`v3p{
literal 0
HcmV?d00001
diff --git a/ArmPkg/Library/GccLto/liblto-aarch64.s b/ArmPkg/Library/GccLto/liblto-aarch64.s
new file mode 100644
index 000000000000..45000d327758
--- /dev/null
+++ b/ArmPkg/Library/GccLto/liblto-aarch64.s
@@ -0,0 +1,27 @@
+//
+// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
+//
+// This program and the accompanying materials are licensed and made available under
+// the terms and conditions of the BSD License that accompanies this distribution.
+// The full text of the license may be found at
+// http://opensource.org/licenses/bsd-license.php.
+//
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+//
+
+//
+// GCC in LTO mode interoperates poorly with non-standard libraries that
+// provide implementations of compiler intrinsics such as memcpy/memset
+// or the stack protector entry points.
+//
+// By referencing these functions from a non-LTO object that can be passed
+// to the linker via the -plugin-opt=-pass-through=-lxxx options, the
+// intrinsics are included in the link in a way that allows them to be
+// pruned again if no other references to them exist.
+//
+
+ .long memcpy - .
+ .long memset - .
+ .long __stack_chk_fail - .
+ .long __stack_chk_guard - .
diff --git a/ArmPkg/Library/GccLto/liblto-arm.a b/ArmPkg/Library/GccLto/liblto-arm.a
new file mode 100644
index 0000000000000000000000000000000000000000..d811c09573a35ea87a8002ecf01be18e1c6e7fd3
GIT binary patch
literal 2096
zcmd6o%WKq76vn?XQ*C|Js#WW|YOD1@u(oJH7cHm=wjd(Xg%C3{sS}#eGD-SEunQLz
zT?o1mx)E36&V>ti;!4n^e}Mi6u3h<^n@J{fT<Fp}Ouq9w_nvbfNlqSKoxD~mm5{X(
zhR`D5^G4ItF=}K8T}U0-`2R^Kc5yYX=T>}_x@dNmx{6!*W2si#P63O*VzW?IBihqh
z=)ig*pojKb#bw326`xc*toV}R>x!op&nRA0ysG%I;^&HAD}JZ=gW^w$zbO8u_=n=3
zihn6C7jA)^cemm`#e<4%#TOM%D88Zij$&7Fpm;^`6UFO_-zdgF4UQAVZgtkF)@Pj=
z*ALnp_Y=1vL)@s|sQDwQ6*Mh*7aYIlFNiybaLxo6PTG16rQHlllhBAv-k>#u2@Sol
zI=`G}CPrQiN;tRR(ak(*AdNItn6xb{AamTrttlr6972!~lYGJ?&mg`uh4`8leFjDu
zR1H=l|GXG+(@3h}e9gF`ML(|A$Jm)#Ny{9*kb6fYIz6K#U~GZXiE;<`AQQJZh#Ex*
zvPafpsg(EM+QeEU%F9+!7AJXjt<6BM=oX+)l${4fw*md4-N1n8cCac_8FW^32XIbw
zCm?m%V%-}PWwOhnEHdMwdw?sVdjY8%7AKh$-3Qzh-4EOrJpf1@u{il%(L=yJ(ZfJZ
z^axNF?FRzUqrklAF(4K_4lIdsu@6KCfmP8Hz#~x>xiwL4;;HB<;F;)Y;DzWJUhHT&
zjNJ+~ZlqeztcDlZv9}b%uDP)byAnmP`PA5M95?(*5_=I7{9EHzOij<eVx#1jh0yHv
z<B{-Nm!6|^Pj~Rl*~wdJ;>*-d{<&4d*_Y!hx!AINvPBvHw{hmarpIg2NWNZUrI#!p
wAAvlV^sI41<6<;hHcoUy=A?e-|05l;7C8giM-Tt9*KBPx@rv+1OG3`f-+dwCzyJUM
literal 0
HcmV?d00001
diff --git a/ArmPkg/Library/GccLto/liblto-arm.s b/ArmPkg/Library/GccLto/liblto-arm.s
new file mode 100644
index 000000000000..bc16320a46c0
--- /dev/null
+++ b/ArmPkg/Library/GccLto/liblto-arm.s
@@ -0,0 +1,61 @@
+//
+// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
+//
+// This program and the accompanying materials are licensed and made available under
+// the terms and conditions of the BSD License that accompanies this distribution.
+// The full text of the license may be found at
+// http://opensource.org/licenses/bsd-license.php.
+//
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+//
+
+//
+// GCC in LTO mode interoperates poorly with non-standard libraries that
+// provide implementations of compiler intrinsics such as memcpy/memset
+// or the stack protector entry points.
+//
+// By referencing these functions from a non-LTO object that can be passed
+// to the linker via the -plugin-opt=-pass-through=-lxxx options, the
+// intrinsics are included in the link in a way that allows them to be
+// pruned again if no other references to them exist.
+//
+
+ .long memcpy - .
+ .long memset - .
+ .long __stack_chk_fail - .
+ .long __stack_chk_guard - .
+ .long __ashrdi3 - .
+ .long __ashldi3 - .
+ .long __aeabi_idiv - .
+ .long __aeabi_idivmod - .
+ .long __aeabi_uidiv - .
+ .long __aeabi_uidivmod - .
+ .long __divdi3 - .
+ .long __divsi3 - .
+ .long __lshrdi3 - .
+ .long __aeabi_memcpy - .
+ .long __aeabi_memset - .
+ .long memmove - .
+ .long __modsi3 - .
+ .long __moddi3 - .
+ .long __muldi3 - .
+ .long __aeabi_lmul - .
+ .long __ARM_ll_mullu - .
+ .long __udivsi3 - .
+ .long __umodsi3 - .
+ .long __udivdi3 - .
+ .long __umoddi3 - .
+ .long __udivmoddi4 - .
+ .long __clzsi2 - .
+ .long __ctzsi2 - .
+ .long __ucmpdi2 - .
+ .long __switch8 - .
+ .long __switchu8 - .
+ .long __switch16 - .
+ .long __switch32 - .
+ .long __aeabi_ulcmp - .
+ .long __aeabi_uldivmod - .
+ .long __aeabi_ldivmod - .
+ .long __aeabi_llsr - .
+ .long __aeabi_llsl - .
--
2.7.4
^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH v5 5/8] ArmPkg: add prebuilt glue binaries for GCC5 LTO support
2016-08-01 8:01 ` [PATCH v5 5/8] ArmPkg: add prebuilt glue binaries for GCC5 LTO support Ard Biesheuvel
@ 2016-08-02 8:50 ` Leif Lindholm
0 siblings, 0 replies; 30+ messages in thread
From: Leif Lindholm @ 2016-08-02 8:50 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: steven.shi, yonghong.zhu, liming.gao, jordan.l.justen, edk2-devel,
lersek
On Mon, Aug 01, 2016 at 10:01:34AM +0200, Ard Biesheuvel wrote:
> GCC in LTO mode interoperates poorly with non-standard libraries that
> provide implementations of compiler intrinsics such as memcpy/memset
> or the stack protector entry points. Such libraries need to be built
> in non-LTO mode, and then referenced explicitly on the linker command
> line using a -plugin-opt=-pass-through=-lxxx linker option.
>
> However, if these intrinsics are also referenced directly, the LTO
> version of the code will be pulled in, and will happily satisfy all
> other references to the same symbol.
>
> So add a pair of glue libraries, for ARM and AARCH64, that reference
> the known intrinsics. Since the binaries live under ArmPkg directly,
> we can reference them in tools_def.txt. Under LD garbage collection,
> the object itself will be pruned, and so will the intrinsics that end
> up unused by the module.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Acked-by: Jordan Justen <jordan.l.justen@intel.com>
If everyone else is happy about this binary file inclusion, I
certainly don't object (given that the source is included).
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> ArmPkg/Library/GccLto/liblto-aarch64.a | Bin 0 -> 1016 bytes
> ArmPkg/Library/GccLto/liblto-aarch64.s | 27 +++++++++
> ArmPkg/Library/GccLto/liblto-arm.a | Bin 0 -> 2096 bytes
> ArmPkg/Library/GccLto/liblto-arm.s | 61 ++++++++++++++++++++
> 4 files changed, 88 insertions(+)
>
> diff --git a/ArmPkg/Library/GccLto/liblto-aarch64.a b/ArmPkg/Library/GccLto/liblto-aarch64.a
> new file mode 100644
> index 0000000000000000000000000000000000000000..2ab00238f0dad882abf08a1fb9623c9cdea9f17b
> GIT binary patch
> literal 1016
> zcmbu7&rZTX5XPqz6oLo!M8btcV>pmaJb3R#Pab@Ovb0qUG$GwJk&}<*)yMErJh~su
> zhGA(FBh#ci^V@G{X8(NLKR&dgh`dGgNxR5Xq8|a14Nj;_ot@whUR;}*D0W|+#ne8)
> z+crcqtbp?TKuy$d;Fk^js)5sWPGwPMt2G8wSV~i4b+$;e`67MRugg8~@}{d?w$pJf
> z%hU2Z13wYMF8ko8f}aWQH5;VNy0m&m%Ghc<&b?O^ORa42Zb{|ZYEm;}M9QPwkz0*h
> zki8>ef}gYSE})e*bOFvFk<j^57EYNXKak(^fcXvc@Z~)5d^m*lCr*Hz|6PAkvlcbK
> oxX>*EVPSp5Eivz1-~TrQyaBwMaQ{8W!rrlD%!Td{2n*}~0;u;a`v3p{
>
> literal 0
> HcmV?d00001
>
> diff --git a/ArmPkg/Library/GccLto/liblto-aarch64.s b/ArmPkg/Library/GccLto/liblto-aarch64.s
> new file mode 100644
> index 000000000000..45000d327758
> --- /dev/null
> +++ b/ArmPkg/Library/GccLto/liblto-aarch64.s
> @@ -0,0 +1,27 @@
> +//
> +// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
> +//
> +// This program and the accompanying materials are licensed and made available under
> +// the terms and conditions of the BSD License that accompanies this distribution.
> +// The full text of the license may be found at
> +// http://opensource.org/licenses/bsd-license.php.
> +//
> +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +//
> +
> +//
> +// GCC in LTO mode interoperates poorly with non-standard libraries that
> +// provide implementations of compiler intrinsics such as memcpy/memset
> +// or the stack protector entry points.
> +//
> +// By referencing these functions from a non-LTO object that can be passed
> +// to the linker via the -plugin-opt=-pass-through=-lxxx options, the
> +// intrinsics are included in the link in a way that allows them to be
> +// pruned again if no other references to them exist.
> +//
> +
> + .long memcpy - .
> + .long memset - .
> + .long __stack_chk_fail - .
> + .long __stack_chk_guard - .
> diff --git a/ArmPkg/Library/GccLto/liblto-arm.a b/ArmPkg/Library/GccLto/liblto-arm.a
> new file mode 100644
> index 0000000000000000000000000000000000000000..d811c09573a35ea87a8002ecf01be18e1c6e7fd3
> GIT binary patch
> literal 2096
> zcmd6o%WKq76vn?XQ*C|Js#WW|YOD1@u(oJH7cHm=wjd(Xg%C3{sS}#eGD-SEunQLz
> zT?o1mx)E36&V>ti;!4n^e}Mi6u3h<^n@J{fT<Fp}Ouq9w_nvbfNlqSKoxD~mm5{X(
> zhR`D5^G4ItF=}K8T}U0-`2R^Kc5yYX=T>}_x@dNmx{6!*W2si#P63O*VzW?IBihqh
> z=)ig*pojKb#bw326`xc*toV}R>x!op&nRA0ysG%I;^&HAD}JZ=gW^w$zbO8u_=n=3
> zihn6C7jA)^cemm`#e<4%#TOM%D88Zij$&7Fpm;^`6UFO_-zdgF4UQAVZgtkF)@Pj=
> z*ALnp_Y=1vL)@s|sQDwQ6*Mh*7aYIlFNiybaLxo6PTG16rQHlllhBAv-k>#u2@Sol
> zI=`G}CPrQiN;tRR(ak(*AdNItn6xb{AamTrttlr6972!~lYGJ?&mg`uh4`8leFjDu
> zR1H=l|GXG+(@3h}e9gF`ML(|A$Jm)#Ny{9*kb6fYIz6K#U~GZXiE;<`AQQJZh#Ex*
> zvPafpsg(EM+QeEU%F9+!7AJXjt<6BM=oX+)l${4fw*md4-N1n8cCac_8FW^32XIbw
> zCm?m%V%-}PWwOhnEHdMwdw?sVdjY8%7AKh$-3Qzh-4EOrJpf1@u{il%(L=yJ(ZfJZ
> z^axNF?FRzUqrklAF(4K_4lIdsu@6KCfmP8Hz#~x>xiwL4;;HB<;F;)Y;DzWJUhHT&
> zjNJ+~ZlqeztcDlZv9}b%uDP)byAnmP`PA5M95?(*5_=I7{9EHzOij<eVx#1jh0yHv
> z<B{-Nm!6|^Pj~Rl*~wdJ;>*-d{<&4d*_Y!hx!AINvPBvHw{hmarpIg2NWNZUrI#!p
> wAAvlV^sI41<6<;hHcoUy=A?e-|05l;7C8giM-Tt9*KBPx@rv+1OG3`f-+dwCzyJUM
>
> literal 0
> HcmV?d00001
>
> diff --git a/ArmPkg/Library/GccLto/liblto-arm.s b/ArmPkg/Library/GccLto/liblto-arm.s
> new file mode 100644
> index 000000000000..bc16320a46c0
> --- /dev/null
> +++ b/ArmPkg/Library/GccLto/liblto-arm.s
> @@ -0,0 +1,61 @@
> +//
> +// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
> +//
> +// This program and the accompanying materials are licensed and made available under
> +// the terms and conditions of the BSD License that accompanies this distribution.
> +// The full text of the license may be found at
> +// http://opensource.org/licenses/bsd-license.php.
> +//
> +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +//
> +
> +//
> +// GCC in LTO mode interoperates poorly with non-standard libraries that
> +// provide implementations of compiler intrinsics such as memcpy/memset
> +// or the stack protector entry points.
> +//
> +// By referencing these functions from a non-LTO object that can be passed
> +// to the linker via the -plugin-opt=-pass-through=-lxxx options, the
> +// intrinsics are included in the link in a way that allows them to be
> +// pruned again if no other references to them exist.
> +//
> +
> + .long memcpy - .
> + .long memset - .
> + .long __stack_chk_fail - .
> + .long __stack_chk_guard - .
> + .long __ashrdi3 - .
> + .long __ashldi3 - .
> + .long __aeabi_idiv - .
> + .long __aeabi_idivmod - .
> + .long __aeabi_uidiv - .
> + .long __aeabi_uidivmod - .
> + .long __divdi3 - .
> + .long __divsi3 - .
> + .long __lshrdi3 - .
> + .long __aeabi_memcpy - .
> + .long __aeabi_memset - .
> + .long memmove - .
> + .long __modsi3 - .
> + .long __moddi3 - .
> + .long __muldi3 - .
> + .long __aeabi_lmul - .
> + .long __ARM_ll_mullu - .
> + .long __udivsi3 - .
> + .long __umodsi3 - .
> + .long __udivdi3 - .
> + .long __umoddi3 - .
> + .long __udivmoddi4 - .
> + .long __clzsi2 - .
> + .long __ctzsi2 - .
> + .long __ucmpdi2 - .
> + .long __switch8 - .
> + .long __switchu8 - .
> + .long __switch16 - .
> + .long __switch32 - .
> + .long __aeabi_ulcmp - .
> + .long __aeabi_uldivmod - .
> + .long __aeabi_ldivmod - .
> + .long __aeabi_llsr - .
> + .long __aeabi_llsl - .
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v5 6/8] BaseTools GCC: drop GNU notes section from EFI image
2016-08-01 8:01 [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode Ard Biesheuvel
` (4 preceding siblings ...)
2016-08-01 8:01 ` [PATCH v5 5/8] ArmPkg: add prebuilt glue binaries for GCC5 LTO support Ard Biesheuvel
@ 2016-08-01 8:01 ` Ard Biesheuvel
2016-08-01 8:01 ` [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points Ard Biesheuvel
` (3 subsequent siblings)
9 siblings, 0 replies; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 8:01 UTC (permalink / raw)
To: steven.shi, yonghong.zhu, liming.gao, jordan.l.justen, edk2-devel
Cc: leif.lindholm, lersek, Ard Biesheuvel
Recent versions of GNU ld automatically emit a .notes section into
the ELF binary containing a build id. Since this is an allocatable
section by default, it will be identified by GenFw as a section
that requires PE/COFF conversion, which may cause sections to be
moved around unexpectedly.
So retain the section, but tag it as INFO, which tells the linker
that it should not be accounted for in the binary's memory layout.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
---
BaseTools/Scripts/GccBase.lds | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds
index 7e4cdde9bfea..281af8a9bd33 100644
--- a/BaseTools/Scripts/GccBase.lds
+++ b/BaseTools/Scripts/GccBase.lds
@@ -62,6 +62,12 @@ SECTIONS {
KEEP (*(.hii))
}
+ /*
+ * Retain the GNU build id but in a non-allocatable section so GenFw
+ * does not copy it into the PE/COFF image.
+ */
+ .build-id (INFO) : { *(.note.gnu.build-id) }
+
/DISCARD/ : {
*(.note.GNU-stack)
*(.gnu_debuglink)
--
2.7.4
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
2016-08-01 8:01 [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode Ard Biesheuvel
` (5 preceding siblings ...)
2016-08-01 8:01 ` [PATCH v5 6/8] BaseTools GCC: drop GNU notes section from EFI image Ard Biesheuvel
@ 2016-08-01 8:01 ` Ard Biesheuvel
2016-08-01 14:18 ` Gao, Liming
2016-08-01 8:01 ` [PATCH v5 8/8] BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO mode Ard Biesheuvel
` (2 subsequent siblings)
9 siblings, 1 reply; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 8:01 UTC (permalink / raw)
To: steven.shi, yonghong.zhu, liming.gao, jordan.l.justen, edk2-devel
Cc: leif.lindholm, lersek, Ard Biesheuvel
When building with LTO enabled, the LTO routines infer from the 'hidden'
visibility of the _ModuleEntryPoint symbol that its code only needs to be
retained if it is referenced internally, and disregards the fact that
it is referenced by the entry point field in the ELF metadata.
This is arguably a bug in LTO, but we can work around it by ensuring that
the _ModuleEntryPoint symbol is emitted with protected visibility instead.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
MdePkg/Include/X64/ProcessorBind.h | 9 ++++++++-
MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf | 2 ++
MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf | 2 ++
MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf | 2 ++
MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf | 2 ++
MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf | 2 ++
6 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h
index 666cc8e8bd16..e45b9cba2bb3 100644
--- a/MdePkg/Include/X64/ProcessorBind.h
+++ b/MdePkg/Include/X64/ProcessorBind.h
@@ -29,13 +29,20 @@
#if defined(__GNUC__) && defined(__pic__)
//
-// Mark all symbol declarations and references as hidden, meaning they will
+// Mark all symbol declarations and references as hidden*, meaning they will
// not be subject to symbol preemption. This allows the compiler to refer to
// symbols directly using relative references rather than via the GOT, which
// contains absolute symbol addresses that are subject to runtime relocation.
//
+// * Under LTO, the entry point of a module must have protected or default
+// visibility to prevent it from being pruned.
+//
+#ifdef GCC_VISIBILITY_PROTECTED
+#pragma GCC visibility push (protected)
+#else
#pragma GCC visibility push (hidden)
#endif
+#endif
#if defined(__INTEL_COMPILER)
//
diff --git a/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf b/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
index 01f64c34c7a1..2d6f87ed062e 100644
--- a/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+++ b/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
@@ -39,3 +39,5 @@ [LibraryClasses]
BaseLib
DebugLib
+[BuildOptions]
+ GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
diff --git a/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf b/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
index d920306713c5..4e61783b3bd5 100644
--- a/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
+++ b/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
@@ -37,3 +37,5 @@ [LibraryClasses]
BaseLib
DebugLib
+[BuildOptions]
+ GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
diff --git a/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf b/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
index a2db9e058bbe..adfd91bdc57e 100644
--- a/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
+++ b/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
@@ -37,3 +37,5 @@ [Packages]
[LibraryClasses]
DebugLib
+[BuildOptions]
+ GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
diff --git a/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf b/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
index be92b3dc0760..9525c55c2051 100644
--- a/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+++ b/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
@@ -38,3 +38,5 @@ [LibraryClasses]
DebugLib
BaseLib
+[BuildOptions]
+ GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
diff --git a/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf b/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
index 7a9dcbcd4df2..8d30b1197850 100644
--- a/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+++ b/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
@@ -65,3 +65,5 @@ [Depex.common.UEFI_DRIVER]
gEfiVariableArchProtocolGuid AND
gEfiWatchdogTimerArchProtocolGuid
+[BuildOptions]
+ GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
--
2.7.4
^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
2016-08-01 8:01 ` [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points Ard Biesheuvel
@ 2016-08-01 14:18 ` Gao, Liming
2016-08-01 14:49 ` Ard Biesheuvel
0 siblings, 1 reply; 30+ messages in thread
From: Gao, Liming @ 2016-08-01 14:18 UTC (permalink / raw)
To: 'Ard Biesheuvel', Shi, Steven, Zhu, Yonghong,
Justen, Jordan L, edk2-devel@lists.01.org
Cc: lersek@redhat.com, leif.lindholm@linaro.org
Ard:
I don't think it is good way to define GCC_VISIBILITY_PROTECTED and apply it in EntryPointLib. We only need to expose _ModuleEntryPoint. It has been specified in LINK_FLAGS in tools_def.txt. Could we also specify its attribute in CC_FLAGS or LINK_FLAGS in tools_def.txt?
Thanks
Liming
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Ard Biesheuvel
> Sent: Monday, August 01, 2016 4:02 PM
> To: Shi, Steven ; Zhu, Yonghong
> ; Gao, Liming ; Justen,
> Jordan L ; edk2-devel@lists.01.org
> Cc: lersek@redhat.com; leif.lindholm@linaro.org; Ard Biesheuvel
>
> Subject: [edk2] [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for
> module entry points
>
> When building with LTO enabled, the LTO routines infer from the 'hidden'
> visibility of the _ModuleEntryPoint symbol that its code only needs to be
> retained if it is referenced internally, and disregards the fact that
> it is referenced by the entry point field in the ELF metadata.
>
> This is arguably a bug in LTO, but we can work around it by ensuring that
> the _ModuleEntryPoint symbol is emitted with protected visibility instead.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel
> ---
> MdePkg/Include/X64/ProcessorBind.h | 9 ++++++++-
> MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf | 2 ++
> MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf | 2 ++
> MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf | 2 ++
> MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf | 2
> ++
> MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf | 2 ++
> 6 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/MdePkg/Include/X64/ProcessorBind.h
> b/MdePkg/Include/X64/ProcessorBind.h
> index 666cc8e8bd16..e45b9cba2bb3 100644
> --- a/MdePkg/Include/X64/ProcessorBind.h
> +++ b/MdePkg/Include/X64/ProcessorBind.h
> @@ -29,13 +29,20 @@
>
> #if defined(__GNUC__) && defined(__pic__)
> //
> -// Mark all symbol declarations and references as hidden, meaning they will
> +// Mark all symbol declarations and references as hidden*, meaning they
> will
> // not be subject to symbol preemption. This allows the compiler to refer to
> // symbols directly using relative references rather than via the GOT, which
> // contains absolute symbol addresses that are subject to runtime relocation.
> //
> +// * Under LTO, the entry point of a module must have protected or default
> +// visibility to prevent it from being pruned.
> +//
> +#ifdef GCC_VISIBILITY_PROTECTED
> +#pragma GCC visibility push (protected)
> +#else
> #pragma GCC visibility push (hidden)
> #endif
> +#endif
>
> #if defined(__INTEL_COMPILER)
> //
> diff --git a/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
> b/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
> index 01f64c34c7a1..2d6f87ed062e 100644
> --- a/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
> +++ b/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
> @@ -39,3 +39,5 @@ [LibraryClasses]
> BaseLib
> DebugLib
>
> +[BuildOptions]
> + GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
> diff --git a/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
> b/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
> index d920306713c5..4e61783b3bd5 100644
> --- a/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
> +++ b/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
> @@ -37,3 +37,5 @@ [LibraryClasses]
> BaseLib
> DebugLib
>
> +[BuildOptions]
> + GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
> diff --git a/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
> b/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
> index a2db9e058bbe..adfd91bdc57e 100644
> --- a/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
> +++ b/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
> @@ -37,3 +37,5 @@ [Packages]
> [LibraryClasses]
> DebugLib
>
> +[BuildOptions]
> + GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
> diff --git
> a/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
> b/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
> index be92b3dc0760..9525c55c2051 100644
> ---
> a/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
> +++
> b/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
> @@ -38,3 +38,5 @@ [LibraryClasses]
> DebugLib
> BaseLib
>
> +[BuildOptions]
> + GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
> diff --git a/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
> b/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
> index 7a9dcbcd4df2..8d30b1197850 100644
> --- a/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
> +++ b/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
> @@ -65,3 +65,5 @@ [Depex.common.UEFI_DRIVER]
> gEfiVariableArchProtocolGuid AND
> gEfiWatchdogTimerArchProtocolGuid
>
> +[BuildOptions]
> + GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
> --
> 2.7.4
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
2016-08-01 14:18 ` Gao, Liming
@ 2016-08-01 14:49 ` Ard Biesheuvel
2016-08-01 14:56 ` Ard Biesheuvel
0 siblings, 1 reply; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 14:49 UTC (permalink / raw)
To: Gao, Liming
Cc: Shi, Steven, Zhu, Yonghong, Justen, Jordan L,
edk2-devel@lists.01.org, lersek@redhat.com,
leif.lindholm@linaro.org
On 1 August 2016 at 16:18, Gao, Liming <liming.gao@intel.com> wrote:
> Ard:
> I don't think it is good way to define GCC_VISIBILITY_PROTECTED and apply it in EntryPointLib. We only need to expose _ModuleEntryPoint. It has been specified in LINK_FLAGS in tools_def.txt. Could we also specify its attribute in CC_FLAGS or LINK_FLAGS in tools_def.txt?
>
It seems this does the trick as well
diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds
index 281af8a9bd33..02387d4f8d6f 100644
--- a/BaseTools/Scripts/GccBase.lds
+++ b/BaseTools/Scripts/GccBase.lds
@@ -80,3 +80,7 @@ SECTIONS {
*(COMMON)
}
}
+
+VERSION {
+ { global: _ModuleEntryPoint*; };
+};
Note that * at the end: this is necessary since _ModuleEntryPoint will
be called _ModuleEntryPoint.lto_priv.xxx in the LTO objects.
I will drop this patch, and add this hunk to GccBase.lds instead.
--
Ard.
> Thanks
> Liming
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Ard Biesheuvel
>> Sent: Monday, August 01, 2016 4:02 PM
>> To: Shi, Steven ; Zhu, Yonghong
>> ; Gao, Liming ; Justen,
>> Jordan L ; edk2-devel@lists.01.org
>> Cc: lersek@redhat.com; leif.lindholm@linaro.org; Ard Biesheuvel
>>
>> Subject: [edk2] [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for
>> module entry points
>>
>> When building with LTO enabled, the LTO routines infer from the 'hidden'
>> visibility of the _ModuleEntryPoint symbol that its code only needs to be
>> retained if it is referenced internally, and disregards the fact that
>> it is referenced by the entry point field in the ELF metadata.
>>
>> This is arguably a bug in LTO, but we can work around it by ensuring that
>> the _ModuleEntryPoint symbol is emitted with protected visibility instead.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Ard Biesheuvel
>> ---
>> MdePkg/Include/X64/ProcessorBind.h | 9 ++++++++-
>> MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf | 2 ++
>> MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf | 2 ++
>> MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf | 2 ++
>> MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf | 2
>> ++
>> MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf | 2 ++
>> 6 files changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/MdePkg/Include/X64/ProcessorBind.h
>> b/MdePkg/Include/X64/ProcessorBind.h
>> index 666cc8e8bd16..e45b9cba2bb3 100644
>> --- a/MdePkg/Include/X64/ProcessorBind.h
>> +++ b/MdePkg/Include/X64/ProcessorBind.h
>> @@ -29,13 +29,20 @@
>>
>> #if defined(__GNUC__) && defined(__pic__)
>> //
>> -// Mark all symbol declarations and references as hidden, meaning they will
>> +// Mark all symbol declarations and references as hidden*, meaning they
>> will
>> // not be subject to symbol preemption. This allows the compiler to refer to
>> // symbols directly using relative references rather than via the GOT, which
>> // contains absolute symbol addresses that are subject to runtime relocation.
>> //
>> +// * Under LTO, the entry point of a module must have protected or default
>> +// visibility to prevent it from being pruned.
>> +//
>> +#ifdef GCC_VISIBILITY_PROTECTED
>> +#pragma GCC visibility push (protected)
>> +#else
>> #pragma GCC visibility push (hidden)
>> #endif
>> +#endif
>>
>> #if defined(__INTEL_COMPILER)
>> //
>> diff --git a/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
>> b/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
>> index 01f64c34c7a1..2d6f87ed062e 100644
>> --- a/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
>> +++ b/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
>> @@ -39,3 +39,5 @@ [LibraryClasses]
>> BaseLib
>> DebugLib
>>
>> +[BuildOptions]
>> + GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
>> diff --git a/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
>> b/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
>> index d920306713c5..4e61783b3bd5 100644
>> --- a/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
>> +++ b/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
>> @@ -37,3 +37,5 @@ [LibraryClasses]
>> BaseLib
>> DebugLib
>>
>> +[BuildOptions]
>> + GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
>> diff --git a/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
>> b/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
>> index a2db9e058bbe..adfd91bdc57e 100644
>> --- a/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
>> +++ b/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
>> @@ -37,3 +37,5 @@ [Packages]
>> [LibraryClasses]
>> DebugLib
>>
>> +[BuildOptions]
>> + GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
>> diff --git
>> a/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
>> b/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
>> index be92b3dc0760..9525c55c2051 100644
>> ---
>> a/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
>> +++
>> b/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
>> @@ -38,3 +38,5 @@ [LibraryClasses]
>> DebugLib
>> BaseLib
>>
>> +[BuildOptions]
>> + GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
>> diff --git a/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
>> b/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
>> index 7a9dcbcd4df2..8d30b1197850 100644
>> --- a/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
>> +++ b/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
>> @@ -65,3 +65,5 @@ [Depex.common.UEFI_DRIVER]
>> gEfiVariableArchProtocolGuid AND
>> gEfiWatchdogTimerArchProtocolGuid
>>
>> +[BuildOptions]
>> + GCC:*_*_X64_CC_FLAGS = -DGCC_VISIBILITY_PROTECTED
>> --
>> 2.7.4
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
2016-08-01 14:49 ` Ard Biesheuvel
@ 2016-08-01 14:56 ` Ard Biesheuvel
2016-08-01 15:51 ` Ard Biesheuvel
0 siblings, 1 reply; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 14:56 UTC (permalink / raw)
To: Gao, Liming
Cc: Shi, Steven, Zhu, Yonghong, Justen, Jordan L,
edk2-devel@lists.01.org, lersek@redhat.com,
leif.lindholm@linaro.org
On 1 August 2016 at 16:49, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 1 August 2016 at 16:18, Gao, Liming <liming.gao@intel.com> wrote:
>> Ard:
>> I don't think it is good way to define GCC_VISIBILITY_PROTECTED and apply it in EntryPointLib. We only need to expose _ModuleEntryPoint. It has been specified in LINK_FLAGS in tools_def.txt. Could we also specify its attribute in CC_FLAGS or LINK_FLAGS in tools_def.txt?
>>
>
> It seems this does the trick as well
>
> diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds
> index 281af8a9bd33..02387d4f8d6f 100644
> --- a/BaseTools/Scripts/GccBase.lds
> +++ b/BaseTools/Scripts/GccBase.lds
> @@ -80,3 +80,7 @@ SECTIONS {
> *(COMMON)
> }
> }
> +
> +VERSION {
> + { global: _ModuleEntryPoint*; };
> +};
>
>
> Note that * at the end: this is necessary since _ModuleEntryPoint will
> be called _ModuleEntryPoint.lto_priv.xxx in the LTO objects.
>
Hmm, looks like I spoke too soon. I don't know what I did wrong, but
this does not actually work.
--
Ard.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
2016-08-01 14:56 ` Ard Biesheuvel
@ 2016-08-01 15:51 ` Ard Biesheuvel
2016-08-01 16:11 ` Ard Biesheuvel
0 siblings, 1 reply; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 15:51 UTC (permalink / raw)
To: Gao, Liming
Cc: Shi, Steven, Zhu, Yonghong, Justen, Jordan L,
edk2-devel@lists.01.org, lersek@redhat.com,
leif.lindholm@linaro.org
On 1 August 2016 at 16:56, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 1 August 2016 at 16:49, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>> On 1 August 2016 at 16:18, Gao, Liming <liming.gao@intel.com> wrote:
>>> Ard:
>>> I don't think it is good way to define GCC_VISIBILITY_PROTECTED and apply it in EntryPointLib. We only need to expose _ModuleEntryPoint. It has been specified in LINK_FLAGS in tools_def.txt. Could we also specify its attribute in CC_FLAGS or LINK_FLAGS in tools_def.txt?
>>>
>>
>> It seems this does the trick as well
>>
>> diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds
>> index 281af8a9bd33..02387d4f8d6f 100644
>> --- a/BaseTools/Scripts/GccBase.lds
>> +++ b/BaseTools/Scripts/GccBase.lds
>> @@ -80,3 +80,7 @@ SECTIONS {
>> *(COMMON)
>> }
>> }
>> +
>> +VERSION {
>> + { global: _ModuleEntryPoint*; };
>> +};
>>
>>
>> Note that * at the end: this is necessary since _ModuleEntryPoint will
>> be called _ModuleEntryPoint.lto_priv.xxx in the LTO objects.
>>
>
> Hmm, looks like I spoke too soon. I don't know what I did wrong, but
> this does not actually work.
>
The only alternative I can think of is to add a static non-lto object
to the tree that refers to _ModuleEntryPoint, similar to the way I
handle the ARM intrinsics in patch #5
Which one do you hate the least? :-)
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
2016-08-01 15:51 ` Ard Biesheuvel
@ 2016-08-01 16:11 ` Ard Biesheuvel
2016-08-02 2:39 ` Gao, Liming
0 siblings, 1 reply; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 16:11 UTC (permalink / raw)
To: Gao, Liming
Cc: Shi, Steven, Zhu, Yonghong, Justen, Jordan L,
edk2-devel@lists.01.org, lersek@redhat.com,
leif.lindholm@linaro.org
On 1 August 2016 at 17:51, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 1 August 2016 at 16:56, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>> On 1 August 2016 at 16:49, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>>> On 1 August 2016 at 16:18, Gao, Liming <liming.gao@intel.com> wrote:
>>>> Ard:
>>>> I don't think it is good way to define GCC_VISIBILITY_PROTECTED and apply it in EntryPointLib. We only need to expose _ModuleEntryPoint. It has been specified in LINK_FLAGS in tools_def.txt. Could we also specify its attribute in CC_FLAGS or LINK_FLAGS in tools_def.txt?
>>>>
>>>
>>> It seems this does the trick as well
>>>
>>> diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds
>>> index 281af8a9bd33..02387d4f8d6f 100644
>>> --- a/BaseTools/Scripts/GccBase.lds
>>> +++ b/BaseTools/Scripts/GccBase.lds
>>> @@ -80,3 +80,7 @@ SECTIONS {
>>> *(COMMON)
>>> }
>>> }
>>> +
>>> +VERSION {
>>> + { global: _ModuleEntryPoint*; };
>>> +};
>>>
>>>
>>> Note that * at the end: this is necessary since _ModuleEntryPoint will
>>> be called _ModuleEntryPoint.lto_priv.xxx in the LTO objects.
>>>
>>
>> Hmm, looks like I spoke too soon. I don't know what I did wrong, but
>> this does not actually work.
>>
>
> The only alternative I can think of is to add a static non-lto object
> to the tree that refers to _ModuleEntryPoint, similar to the way I
> handle the ARM intrinsics in patch #5
>
As it turns out, the LTO linker does not need to visibility pragma to
prevent it from emitting GOT based relocations. This makes sense,
considering that the LTO linker can see that no symbol references are
ever satisfied across dynamic object boundaries. That means I could
work around this in the following way:
diff --git a/BaseTools/Conf/tools_def.template
b/BaseTools/Conf/tools_def.template
index 314adaf6bfa8..983e2fea7390 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4462,7 +4462,7 @@ DEFINE GCC49_ARM_ASLDLINK_FLAGS =
DEF(GCC48_ARM_ASLDLINK_FLAGS)
DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -flto
-fno-builtin
-DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto
-fno-builtin
+DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto
-fno-builtin -DUSING_LTO
DEFINE GCC5_IA32_X64_DLINK_COMMON = DEF(GCC49_IA32_X64_DLINK_COMMON)
DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS)
DEFINE GCC5_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -flto
diff --git a/MdePkg/Include/X64/ProcessorBind.h
b/MdePkg/Include/X64/ProcessorBind.h
index 666cc8e8bd16..77fab7055afc 100644
--- a/MdePkg/Include/X64/ProcessorBind.h
+++ b/MdePkg/Include/X64/ProcessorBind.h
@@ -27,12 +27,15 @@
#pragma pack()
#endif
-#if defined(__GNUC__) && defined(__pic__)
+#if defined(__GNUC__) && defined(__pic__) && !defined(USING_LTO)
//
// Mark all symbol declarations and references as hidden, meaning they will
// not be subject to symbol preemption. This allows the compiler to refer to
// symbols directly using relative references rather than via the GOT, which
// contains absolute symbol addresses that are subject to runtime relocation.
+// The LTO linker will not emit GOT based relocations anyway, so there is no
+// need to set the pragma in that case (and doing so will cause issues of its
+// own)
//
#pragma GCC visibility push (hidden)
#endif
and I can drop this patch.
^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
2016-08-01 16:11 ` Ard Biesheuvel
@ 2016-08-02 2:39 ` Gao, Liming
2016-08-02 5:26 ` Gao, Liming
0 siblings, 1 reply; 30+ messages in thread
From: Gao, Liming @ 2016-08-02 2:39 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Shi, Steven, Zhu, Yonghong, Justen, Jordan L,
edk2-devel@lists.01.org, lersek@redhat.com,
leif.lindholm@linaro.org
Ard:
I will verify it. And, I would ask why only X64 requires it? IA32, ARM and AARCH64 doesn't specially handle it?
Thanks
Liming
> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Tuesday, August 02, 2016 12:12 AM
> To: Gao, Liming <liming.gao@intel.com>
> Cc: Shi, Steven <steven.shi@intel.com>; Zhu, Yonghong
> <yonghong.zhu@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>;
> edk2-devel@lists.01.org; lersek@redhat.com; leif.lindholm@linaro.org
> Subject: Re: [edk2] [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility
> for module entry points
>
> On 1 August 2016 at 17:51, Ard Biesheuvel <ard.biesheuvel@linaro.org>
> wrote:
> > On 1 August 2016 at 16:56, Ard Biesheuvel <ard.biesheuvel@linaro.org>
> wrote:
> >> On 1 August 2016 at 16:49, Ard Biesheuvel <ard.biesheuvel@linaro.org>
> wrote:
> >>> On 1 August 2016 at 16:18, Gao, Liming <liming.gao@intel.com> wrote:
> >>>> Ard:
> >>>> I don't think it is good way to define GCC_VISIBILITY_PROTECTED and
> apply it in EntryPointLib. We only need to expose _ModuleEntryPoint. It has
> been specified in LINK_FLAGS in tools_def.txt. Could we also specify its
> attribute in CC_FLAGS or LINK_FLAGS in tools_def.txt?
> >>>>
> >>>
> >>> It seems this does the trick as well
> >>>
> >>> diff --git a/BaseTools/Scripts/GccBase.lds
> b/BaseTools/Scripts/GccBase.lds
> >>> index 281af8a9bd33..02387d4f8d6f 100644
> >>> --- a/BaseTools/Scripts/GccBase.lds
> >>> +++ b/BaseTools/Scripts/GccBase.lds
> >>> @@ -80,3 +80,7 @@ SECTIONS {
> >>> *(COMMON)
> >>> }
> >>> }
> >>> +
> >>> +VERSION {
> >>> + { global: _ModuleEntryPoint*; };
> >>> +};
> >>>
> >>>
> >>> Note that * at the end: this is necessary since _ModuleEntryPoint will
> >>> be called _ModuleEntryPoint.lto_priv.xxx in the LTO objects.
> >>>
> >>
> >> Hmm, looks like I spoke too soon. I don't know what I did wrong, but
> >> this does not actually work.
> >>
> >
> > The only alternative I can think of is to add a static non-lto object
> > to the tree that refers to _ModuleEntryPoint, similar to the way I
> > handle the ARM intrinsics in patch #5
> >
>
> As it turns out, the LTO linker does not need to visibility pragma to
> prevent it from emitting GOT based relocations. This makes sense,
> considering that the LTO linker can see that no symbol references are
> ever satisfied across dynamic object boundaries. That means I could
> work around this in the following way:
>
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 314adaf6bfa8..983e2fea7390 100644
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -4462,7 +4462,7 @@ DEFINE GCC49_ARM_ASLDLINK_FLAGS =
> DEF(GCC48_ARM_ASLDLINK_FLAGS)
> DEFINE GCC49_AARCH64_ASLDLINK_FLAGS =
> DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
>
> DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -flto
> -fno-builtin
> -DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto
> -fno-builtin
> +DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto
> -fno-builtin -DUSING_LTO
> DEFINE GCC5_IA32_X64_DLINK_COMMON =
> DEF(GCC49_IA32_X64_DLINK_COMMON)
> DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS =
> DEF(GCC49_IA32_X64_ASLDLINK_FLAGS)
> DEFINE GCC5_IA32_X64_DLINK_FLAGS =
> DEF(GCC49_IA32_X64_DLINK_FLAGS) -flto
> diff --git a/MdePkg/Include/X64/ProcessorBind.h
> b/MdePkg/Include/X64/ProcessorBind.h
> index 666cc8e8bd16..77fab7055afc 100644
> --- a/MdePkg/Include/X64/ProcessorBind.h
> +++ b/MdePkg/Include/X64/ProcessorBind.h
> @@ -27,12 +27,15 @@
> #pragma pack()
> #endif
>
> -#if defined(__GNUC__) && defined(__pic__)
> +#if defined(__GNUC__) && defined(__pic__) && !defined(USING_LTO)
> //
> // Mark all symbol declarations and references as hidden, meaning they will
> // not be subject to symbol preemption. This allows the compiler to refer to
> // symbols directly using relative references rather than via the GOT, which
> // contains absolute symbol addresses that are subject to runtime relocation.
> +// The LTO linker will not emit GOT based relocations anyway, so there is no
> +// need to set the pragma in that case (and doing so will cause issues of its
> +// own)
> //
> #pragma GCC visibility push (hidden)
> #endif
>
> and I can drop this patch.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
2016-08-02 2:39 ` Gao, Liming
@ 2016-08-02 5:26 ` Gao, Liming
0 siblings, 0 replies; 30+ messages in thread
From: Gao, Liming @ 2016-08-02 5:26 UTC (permalink / raw)
To: Gao, Liming, Ard Biesheuvel
Cc: Justen, Jordan L, edk2-devel@lists.01.org,
leif.lindholm@linaro.org, lersek@redhat.com, Gao, Liming
Ard:
This update works. It is better. For my question, I get the answer from your previous patch. Please ignore it.
Patches 3&4&6&8 are good to me. Reviewed-by: Liming Gao <liming.gao@intel.com>
Thanks
Liming
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Gao, Liming
> Sent: Tuesday, August 02, 2016 10:39 AM
> To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Justen, Jordan L <jordan.l.justen@intel.com>; edk2-devel@lists.01.org;
> leif.lindholm@linaro.org; lersek@redhat.com
> Subject: Re: [edk2] [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility
> for module entry points
>
> Ard:
> I will verify it. And, I would ask why only X64 requires it? IA32, ARM and
> AARCH64 doesn't specially handle it?
>
> Thanks
> Liming
> > -----Original Message-----
> > From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> > Sent: Tuesday, August 02, 2016 12:12 AM
> > To: Gao, Liming <liming.gao@intel.com>
> > Cc: Shi, Steven <steven.shi@intel.com>; Zhu, Yonghong
> > <yonghong.zhu@intel.com>; Justen, Jordan L <jordan.l.justen@intel.com>;
> > edk2-devel@lists.01.org; lersek@redhat.com; leif.lindholm@linaro.org
> > Subject: Re: [edk2] [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden'
> visibility
> > for module entry points
> >
> > On 1 August 2016 at 17:51, Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > wrote:
> > > On 1 August 2016 at 16:56, Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > wrote:
> > >> On 1 August 2016 at 16:49, Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > wrote:
> > >>> On 1 August 2016 at 16:18, Gao, Liming <liming.gao@intel.com> wrote:
> > >>>> Ard:
> > >>>> I don't think it is good way to define GCC_VISIBILITY_PROTECTED
> and
> > apply it in EntryPointLib. We only need to expose _ModuleEntryPoint. It
> has
> > been specified in LINK_FLAGS in tools_def.txt. Could we also specify its
> > attribute in CC_FLAGS or LINK_FLAGS in tools_def.txt?
> > >>>>
> > >>>
> > >>> It seems this does the trick as well
> > >>>
> > >>> diff --git a/BaseTools/Scripts/GccBase.lds
> > b/BaseTools/Scripts/GccBase.lds
> > >>> index 281af8a9bd33..02387d4f8d6f 100644
> > >>> --- a/BaseTools/Scripts/GccBase.lds
> > >>> +++ b/BaseTools/Scripts/GccBase.lds
> > >>> @@ -80,3 +80,7 @@ SECTIONS {
> > >>> *(COMMON)
> > >>> }
> > >>> }
> > >>> +
> > >>> +VERSION {
> > >>> + { global: _ModuleEntryPoint*; };
> > >>> +};
> > >>>
> > >>>
> > >>> Note that * at the end: this is necessary since _ModuleEntryPoint will
> > >>> be called _ModuleEntryPoint.lto_priv.xxx in the LTO objects.
> > >>>
> > >>
> > >> Hmm, looks like I spoke too soon. I don't know what I did wrong, but
> > >> this does not actually work.
> > >>
> > >
> > > The only alternative I can think of is to add a static non-lto object
> > > to the tree that refers to _ModuleEntryPoint, similar to the way I
> > > handle the ARM intrinsics in patch #5
> > >
> >
> > As it turns out, the LTO linker does not need to visibility pragma to
> > prevent it from emitting GOT based relocations. This makes sense,
> > considering that the LTO linker can see that no symbol references are
> > ever satisfied across dynamic object boundaries. That means I could
> > work around this in the following way:
> >
> > diff --git a/BaseTools/Conf/tools_def.template
> > b/BaseTools/Conf/tools_def.template
> > index 314adaf6bfa8..983e2fea7390 100644
> > --- a/BaseTools/Conf/tools_def.template
> > +++ b/BaseTools/Conf/tools_def.template
> > @@ -4462,7 +4462,7 @@ DEFINE GCC49_ARM_ASLDLINK_FLAGS =
> > DEF(GCC48_ARM_ASLDLINK_FLAGS)
> > DEFINE GCC49_AARCH64_ASLDLINK_FLAGS =
> > DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
> >
> > DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -flto
> > -fno-builtin
> > -DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto
> > -fno-builtin
> > +DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto
> > -fno-builtin -DUSING_LTO
> > DEFINE GCC5_IA32_X64_DLINK_COMMON =
> > DEF(GCC49_IA32_X64_DLINK_COMMON)
> > DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS =
> > DEF(GCC49_IA32_X64_ASLDLINK_FLAGS)
> > DEFINE GCC5_IA32_X64_DLINK_FLAGS =
> > DEF(GCC49_IA32_X64_DLINK_FLAGS) -flto
> > diff --git a/MdePkg/Include/X64/ProcessorBind.h
> > b/MdePkg/Include/X64/ProcessorBind.h
> > index 666cc8e8bd16..77fab7055afc 100644
> > --- a/MdePkg/Include/X64/ProcessorBind.h
> > +++ b/MdePkg/Include/X64/ProcessorBind.h
> > @@ -27,12 +27,15 @@
> > #pragma pack()
> > #endif
> >
> > -#if defined(__GNUC__) && defined(__pic__)
> > +#if defined(__GNUC__) && defined(__pic__) && !defined(USING_LTO)
> > //
> > // Mark all symbol declarations and references as hidden, meaning they
> will
> > // not be subject to symbol preemption. This allows the compiler to refer
> to
> > // symbols directly using relative references rather than via the GOT, which
> > // contains absolute symbol addresses that are subject to runtime
> relocation.
> > +// The LTO linker will not emit GOT based relocations anyway, so there is
> no
> > +// need to set the pragma in that case (and doing so will cause issues of its
> > +// own)
> > //
> > #pragma GCC visibility push (hidden)
> > #endif
> >
> > and I can drop this patch.
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v5 8/8] BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO mode
2016-08-01 8:01 [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode Ard Biesheuvel
` (6 preceding siblings ...)
2016-08-01 8:01 ` [PATCH v5 7/8] MdePkg GCC/X64: avoid 'hidden' visibility for module entry points Ard Biesheuvel
@ 2016-08-01 8:01 ` Ard Biesheuvel
2016-08-01 14:01 ` [PATCH v5 0/8] BaseTools: add support for GCC5 " Shi, Steven
2016-08-02 9:03 ` Ard Biesheuvel
9 siblings, 0 replies; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 8:01 UTC (permalink / raw)
To: steven.shi, yonghong.zhu, liming.gao, jordan.l.justen, edk2-devel
Cc: leif.lindholm, lersek, Ard Biesheuvel
This adds support for GCC 5.x in LTO mode for IA32, X64, ARM and
AARCH64. Due to the fact that the GCC project switched to a new
numbering scheme where the first digit is now incremented for every
major release, the new toolchain is simply called 'GCC5', and is
intended to support all GCC v5.x releases.
Since IA32 and X64 enable compiler optimizations (-Os) for both DEBUG
and RELEASE builds, LTO support is equally enabled for both targets.
On ARM and AARCH64, DEBUG builds are not optimized, and so the LTO
optimizations are only enabled for RELEASE.
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>
---
BaseTools/Conf/tools_def.template | 164 ++++++++++++++++++++
1 file changed, 164 insertions(+)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 10ac21e42c8f..314adaf6bfa8 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -197,6 +197,9 @@ DEFINE GCC48_X64_PREFIX = ENV(GCC48_BIN)
DEFINE GCC49_IA32_PREFIX = ENV(GCC49_BIN)
DEFINE GCC49_X64_PREFIX = ENV(GCC49_BIN)
+DEFINE GCC5_IA32_PREFIX = ENV(GCC5_BIN)
+DEFINE GCC5_X64_PREFIX = ENV(GCC5_BIN)
+
DEFINE UNIX_IASL_BIN = ENV(IASL_PREFIX)iasl
DEFINE WIN_ASL_BIN_DIR = C:\ASL
DEFINE WIN_IASL_BIN = DEF(WIN_ASL_BIN_DIR)\iasl.exe
@@ -366,6 +369,12 @@ DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G
# Required to build platforms or ACPI tables:
# Intel(r) ACPI Compiler from
# https://acpica.org/downloads
+# GCC5 -Linux,Windows- Requires:
+# GCC 5 with LTO support, targeting x86_64-linux-gnu, aarch64-linux-gnu, or arm-linux-gnueabi
+# Optional:
+# Required to build platforms or ACPI tables:
+# Intel(r) ACPI Compiler from
+# https://acpica.org/downloads
# CLANG35 -Linux,Windows- Requires:
# Clang v3.5 or later, and GNU binutils targeting aarch64-linux-gnu or arm-linux-gnueabi
# Optional:
@@ -4452,6 +4461,27 @@ DEFINE GCC49_AARCH64_DLINK2_FLAGS = DEF(GCC48_AARCH64_DLINK2_FLAGS)
DEFINE GCC49_ARM_ASLDLINK_FLAGS = DEF(GCC48_ARM_ASLDLINK_FLAGS)
DEFINE GCC49_AARCH64_ASLDLINK_FLAGS = DEF(GCC48_AARCH64_ASLDLINK_FLAGS)
+DEFINE GCC5_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -flto -fno-builtin
+DEFINE GCC5_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -flto -fno-builtin
+DEFINE GCC5_IA32_X64_DLINK_COMMON = DEF(GCC49_IA32_X64_DLINK_COMMON)
+DEFINE GCC5_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_ASLDLINK_FLAGS)
+DEFINE GCC5_IA32_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) -flto
+DEFINE GCC5_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS)
+DEFINE GCC5_X64_DLINK_FLAGS = DEF(GCC49_X64_DLINK_FLAGS) -flto
+DEFINE GCC5_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS)
+DEFINE GCC5_ASM_FLAGS = DEF(GCC49_ASM_FLAGS)
+DEFINE GCC5_ARM_ASM_FLAGS = DEF(GCC49_ARM_ASM_FLAGS)
+DEFINE GCC5_AARCH64_ASM_FLAGS = DEF(GCC49_AARCH64_ASM_FLAGS)
+DEFINE GCC5_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS)
+DEFINE GCC5_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS)
+DEFINE GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC49_AARCH64_CC_XIPFLAGS)
+DEFINE GCC5_ARM_DLINK_FLAGS = DEF(GCC49_ARM_DLINK_FLAGS) -flto
+DEFINE GCC5_ARM_DLINK2_FLAGS = DEF(GCC49_ARM_DLINK2_FLAGS)
+DEFINE GCC5_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS) -flto
+DEFINE GCC5_AARCH64_DLINK2_FLAGS = DEF(GCC49_AARCH64_DLINK2_FLAGS)
+DEFINE GCC5_ARM_ASLDLINK_FLAGS = DEF(GCC49_ARM_ASLDLINK_FLAGS)
+DEFINE GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC49_AARCH64_ASLDLINK_FLAGS)
+
####################################################################################
#
# Unix GCC And Intel Linux ACPI Compiler
@@ -5186,6 +5216,140 @@ RELEASE_GCC49_AARCH64_DLINK_FLAGS = DEF(GCC49_AARCH64_DLINK_FLAGS)
####################################################################################
#
+# GCC 5 - This configuration is used to compile under Linux to produce
+# PE/COFF binaries using GCC 5
+#
+####################################################################################
+*_GCC5_*_*_FAMILY = GCC
+
+*_GCC5_*_MAKE_PATH = DEF(GCC5_IA32_PREFIX)make
+*_GCC5_*_*_DLL = ENV(GCC5_DLL)
+*_GCC5_*_ASL_PATH = DEF(UNIX_IASL_BIN)
+
+*_GCC5_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
+*_GCC5_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
+*_GCC5_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_GCC5_*_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
+*_GCC5_*_APP_FLAGS =
+*_GCC5_*_ASL_FLAGS = DEF(IASL_FLAGS)
+*_GCC5_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+
+##################
+# GCC5 IA32 definitions
+##################
+*_GCC5_IA32_OBJCOPY_PATH = DEF(GCC5_IA32_PREFIX)objcopy
+*_GCC5_IA32_CC_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_SLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc-ar
+*_GCC5_IA32_DLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLDLINK_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASM_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_PP_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_VFRPP_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLCC_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_ASLPP_PATH = DEF(GCC5_IA32_PREFIX)gcc
+*_GCC5_IA32_RC_PATH = DEF(GCC5_IA32_PREFIX)objcopy
+
+*_GCC5_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto
+*_GCC5_IA32_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386
+*_GCC5_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386
+*_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Os -Wl,-m,elf_i386,--oformat=elf32-i386
+*_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS)
+*_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
+*_GCC5_IA32_OBJCOPY_FLAGS =
+*_GCC5_IA32_NASM_FLAGS = -f elf32
+
+ DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os
+RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable
+
+##################
+# GCC5 X64 definitions
+##################
+*_GCC5_X64_OBJCOPY_PATH = DEF(GCC5_X64_PREFIX)objcopy
+*_GCC5_X64_CC_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_SLINK_PATH = DEF(GCC5_X64_PREFIX)gcc-ar
+*_GCC5_X64_DLINK_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLDLINK_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASM_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_PP_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_VFRPP_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLCC_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_ASLPP_PATH = DEF(GCC5_X64_PREFIX)gcc
+*_GCC5_X64_RC_PATH = DEF(GCC5_X64_PREFIX)objcopy
+
+*_GCC5_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto
+*_GCC5_X64_ASLDLINK_FLAGS = DEF(GCC5_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64
+*_GCC5_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64
+*_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -Os
+*_GCC5_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS)
+*_GCC5_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
+*_GCC5_X64_OBJCOPY_FLAGS =
+*_GCC5_X64_NASM_FLAGS = -f elf64
+
+ DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS)
+RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -Wno-unused-but-set-variable
+
+##################
+# GCC5 ARM definitions
+##################
+*_GCC5_ARM_CC_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_SLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc-ar
+*_GCC5_ARM_DLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASLDLINK_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASM_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_PP_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_VFRPP_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASLCC_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_ASLPP_PATH = ENV(GCC5_ARM_PREFIX)gcc
+*_GCC5_ARM_RC_PATH = ENV(GCC5_ARM_PREFIX)objcopy
+
+*_GCC5_ARM_ARCHCC_FLAGS = -mthumb
+*_GCC5_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -fno-lto
+*_GCC5_ARM_ASLDLINK_FLAGS = DEF(GCC5_ARM_ASLDLINK_FLAGS)
+*_GCC5_ARM_ASM_FLAGS = DEF(GCC5_ARM_ASM_FLAGS)
+*_GCC5_ARM_DLINK2_FLAGS = DEF(GCC5_ARM_DLINK2_FLAGS)
+*_GCC5_ARM_PLATFORM_FLAGS = -march=armv7-a
+*_GCC5_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
+*_GCC5_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
+*_GCC5_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+
+ DEBUG_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -O0
+RELEASE_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable
+
+ DEBUG_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS)
+RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm
+
+##################
+# GCC5 AARCH64 definitions
+##################
+*_GCC5_AARCH64_CC_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_SLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc-ar
+*_GCC5_AARCH64_DLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASLDLINK_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASM_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_PP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_VFRPP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASLCC_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_ASLPP_PATH = ENV(GCC5_AARCH64_PREFIX)gcc
+*_GCC5_AARCH64_RC_PATH = ENV(GCC5_AARCH64_PREFIX)objcopy
+
+*_GCC5_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -fno-lto
+*_GCC5_AARCH64_ASLDLINK_FLAGS = DEF(GCC5_AARCH64_ASLDLINK_FLAGS)
+*_GCC5_AARCH64_ASM_FLAGS = DEF(GCC5_AARCH64_ASM_FLAGS)
+*_GCC5_AARCH64_DLINK2_FLAGS = DEF(GCC5_AARCH64_DLINK2_FLAGS)
+*_GCC5_AARCH64_PLATFORM_FLAGS =
+*_GCC5_AARCH64_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
+*_GCC5_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS)
+*_GCC5_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC5_AARCH64_CC_XIPFLAGS)
+
+ DEBUG_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -O0 -mcmodel=small
+ DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
+
+RELEASE_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -mcmodel=tiny
+RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64
+
+####################################################################################
+#
# CLANG35 - This configuration is used to compile under Linux to produce
# PE/COFF binaries using the clang compiler and assembler (v3.5 and up)
# and GNU linker
--
2.7.4
^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-01 8:01 [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode Ard Biesheuvel
` (7 preceding siblings ...)
2016-08-01 8:01 ` [PATCH v5 8/8] BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO mode Ard Biesheuvel
@ 2016-08-01 14:01 ` Shi, Steven
2016-08-01 14:04 ` Ard Biesheuvel
2016-08-02 9:03 ` Ard Biesheuvel
9 siblings, 1 reply; 30+ messages in thread
From: Shi, Steven @ 2016-08-01 14:01 UTC (permalink / raw)
To: Ard Biesheuvel, Zhu, Yonghong, Gao, Liming, Justen, Jordan L,
edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, lersek@redhat.com
Ard,
Where can I check out your v5 patch?
Steven Shi
Intel\SSG\STO\UEFI Firmware
Tel: +86 021-61166522
iNet: 821-6522
> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Monday, August 01, 2016 4:01 PM
> To: Shi, Steven <steven.shi@intel.com>; Zhu, Yonghong
> <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>; Justen,
> Jordan L <jordan.l.justen@intel.com>; edk2-devel@lists.01.org
> Cc: leif.lindholm@linaro.org; lersek@redhat.com; Ard Biesheuvel
> <ard.biesheuvel@linaro.org>
> Subject: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
>
> This v5 to introduce GCC5 is now a 8 piece series, including some
> preparatory cleanup patches that allow all GCC4x and CLANG35 toolchains
> to switch to using 'gcc' as the linker. This allows us to get rid of
> the wrapper script to marshall ld arguments in order to make them
> understandable by gcc, which is fragile and likely to cause problems in
> the future.
>
> Since there appears to be a natural split between the 'legacy' GCC
> toolchains UNIXGCC, ELFGCC, and CYGGCC[xASL], both in term of supported
> architectures [IA32, X64, IPF] vs [IA32, X64, ARM, AARCH64], and in
> terms of maintenance, these toolchains are not moved to using 'gcc' as
> the linker, and instead, a new BUILDRULEFAMILY is introduced called GCCLD
> that will retain the old behavior.
>
> The result is that GCC5 can align much more closely with its predecessors,
> making the expected maintenance burden of supporting GCC back to v4.4
> much lower.
>
> Changes since v4:
> - added patch to use 'protected' visibility only for the libraries that
> define the module entry points (_ModuleEntryPoint), to prevent them from
> being optimized away by the LTO routines
> - added Jordan's ack/RBs
> - add some extra comments to tools_def.template (#8)
>
> Changes since v3:
> - like Steven does in his GCC5LTO patch, add -fno-builtin to IA32 and X64
> CC_FLAGS; this addresses a build issue reported by Liming
> - add -Os the the linker flags as well, for AARCH64 this does not seem to
> make
> a difference, but it is arguably correct since the LTO processing at link
> time involves code generation as well
> - add Laszlo's ack to #2
> - new patch #6 to omit the autogenerated build-id from the PE/COFF binary
>
> Changes since v2:
> - add license headers to LTO glue files for ARM and AARCH64 (#5)
> - get rid of lto-ld-wrapper script
>
> Ard Biesheuvel (8):
> BaseTools CLANG35: drop problematic use-movt and save-temps options
> ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note
> sections
> BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into
> GCCLD
> BaseTools GCC: use 'gcc' as the linker command for GCC44 and later
> ArmPkg: add prebuilt glue binaries for GCC5 LTO support
> BaseTools GCC: drop GNU notes section from EFI image
> MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
> BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO
> mode
>
> ArmPkg/GccLto/liblto-aarch64.a | Bin 0 -> 1016 bytes
> ArmPkg/GccLto/liblto-aarch64.s | 27 ++
> ArmPkg/GccLto/liblto-arm.a | Bin 0 -> 2096 bytes
> ArmPkg/GccLto/liblto-arm.s | 61 ++++
> ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 2 +-
> ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds | 3 +
> BaseTools/Conf/build_rule.template | 31 +-
> BaseTools/Conf/tools_def.template | 350
> +++++++++++++++-----
> BaseTools/Scripts/GccBase.lds | 6 +
> EmulatorPkg/Unix/Host/Host.inf | 6 +-
> MdePkg/Include/X64/ProcessorBind.h | 9 +-
> MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf | 2 +
> MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf | 2 +
> MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf | 2 +
> MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf |
> 2 +
> MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf | 2 +
> 16 files changed, 396 insertions(+), 109 deletions(-)
> create mode 100644 ArmPkg/GccLto/liblto-aarch64.a
> create mode 100644 ArmPkg/GccLto/liblto-aarch64.s
> create mode 100644 ArmPkg/GccLto/liblto-arm.a
> create mode 100644 ArmPkg/GccLto/liblto-arm.s
>
> --
> 2.7.4
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-01 14:01 ` [PATCH v5 0/8] BaseTools: add support for GCC5 " Shi, Steven
@ 2016-08-01 14:04 ` Ard Biesheuvel
0 siblings, 0 replies; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-01 14:04 UTC (permalink / raw)
To: Shi, Steven
Cc: Zhu, Yonghong, Gao, Liming, Justen, Jordan L,
edk2-devel@lists.01.org, leif.lindholm@linaro.org,
lersek@redhat.com
On 1 August 2016 at 16:01, Shi, Steven <steven.shi@intel.com> wrote:
> Ard,
> Where can I check out your v5 patch?
>
https://git.linaro.org/people/ard.biesheuvel/uefi-next.git/shortlog/refs/heads/gcc5-lto-v5
or
git://git.linaro.org/people/ard.biesheuvel/uefi-next.git gcc5-lto-v5
Thanks,
Ard.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-01 8:01 [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode Ard Biesheuvel
` (8 preceding siblings ...)
2016-08-01 14:01 ` [PATCH v5 0/8] BaseTools: add support for GCC5 " Shi, Steven
@ 2016-08-02 9:03 ` Ard Biesheuvel
2016-08-02 10:57 ` Laszlo Ersek
2016-08-02 11:41 ` Shi, Steven
9 siblings, 2 replies; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-02 9:03 UTC (permalink / raw)
To: Shi, Steven, Zhu, Yonghong, Gao, Liming, Jordan Justen,
edk2-devel-01
Cc: Leif Lindholm, Laszlo Ersek, Ard Biesheuvel
On 1 August 2016 at 10:01, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> This v5 to introduce GCC5 is now a 8 piece series, including some
> preparatory cleanup patches that allow all GCC4x and CLANG35 toolchains
> to switch to using 'gcc' as the linker. This allows us to get rid of
> the wrapper script to marshall ld arguments in order to make them
> understandable by gcc, which is fragile and likely to cause problems in
> the future.
>
> Since there appears to be a natural split between the 'legacy' GCC
> toolchains UNIXGCC, ELFGCC, and CYGGCC[xASL], both in term of supported
> architectures [IA32, X64, IPF] vs [IA32, X64, ARM, AARCH64], and in
> terms of maintenance, these toolchains are not moved to using 'gcc' as
> the linker, and instead, a new BUILDRULEFAMILY is introduced called GCCLD
> that will retain the old behavior.
>
> The result is that GCC5 can align much more closely with its predecessors,
> making the expected maintenance burden of supporting GCC back to v4.4
> much lower.
>
> Changes since v4:
> - added patch to use 'protected' visibility only for the libraries that
> define the module entry points (_ModuleEntryPoint), to prevent them from
> being optimized away by the LTO routines
> - added Jordan's ack/RBs
> - add some extra comments to tools_def.template (#8)
>
Thanks all. Committed as
1c63516075b3 BaseTools CLANG35: drop problematic use-movt and save-temps options
ff54bcdf2e4e ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash
and .note sections
befb3ba51502 BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule
family into GCCLD
a1b8baccc30b BaseTools GCC: use 'gcc' as the linker command for GCC44 and later
e1458aaded8e ArmPkg: add prebuilt glue binaries for GCC5 LTO support
7fd5d619806d BaseTools GCC: drop GNU notes section from EFI image
4a8466d4baba BaseTools GCC: introduce GCC5 toolchain to support GCC
v5.x in LTO mode
with Leif and Liming's R-b. I dropped patch #7, and instead made the
visibility pragma conditional on whether LTO is disabled.
--
Ard.
> Changes since v3:
> - like Steven does in his GCC5LTO patch, add -fno-builtin to IA32 and X64
> CC_FLAGS; this addresses a build issue reported by Liming
> - add -Os the the linker flags as well, for AARCH64 this does not seem to make
> a difference, but it is arguably correct since the LTO processing at link
> time involves code generation as well
> - add Laszlo's ack to #2
> - new patch #6 to omit the autogenerated build-id from the PE/COFF binary
>
> Changes since v2:
> - add license headers to LTO glue files for ARM and AARCH64 (#5)
> - get rid of lto-ld-wrapper script
>
> Ard Biesheuvel (8):
> BaseTools CLANG35: drop problematic use-movt and save-temps options
> ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note
> sections
> BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into
> GCCLD
> BaseTools GCC: use 'gcc' as the linker command for GCC44 and later
> ArmPkg: add prebuilt glue binaries for GCC5 LTO support
> BaseTools GCC: drop GNU notes section from EFI image
> MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
> BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO
> mode
>
> ArmPkg/GccLto/liblto-aarch64.a | Bin 0 -> 1016 bytes
> ArmPkg/GccLto/liblto-aarch64.s | 27 ++
> ArmPkg/GccLto/liblto-arm.a | Bin 0 -> 2096 bytes
> ArmPkg/GccLto/liblto-arm.s | 61 ++++
> ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 2 +-
> ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds | 3 +
> BaseTools/Conf/build_rule.template | 31 +-
> BaseTools/Conf/tools_def.template | 350 +++++++++++++++-----
> BaseTools/Scripts/GccBase.lds | 6 +
> EmulatorPkg/Unix/Host/Host.inf | 6 +-
> MdePkg/Include/X64/ProcessorBind.h | 9 +-
> MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf | 2 +
> MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf | 2 +
> MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf | 2 +
> MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf | 2 +
> MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf | 2 +
> 16 files changed, 396 insertions(+), 109 deletions(-)
> create mode 100644 ArmPkg/GccLto/liblto-aarch64.a
> create mode 100644 ArmPkg/GccLto/liblto-aarch64.s
> create mode 100644 ArmPkg/GccLto/liblto-arm.a
> create mode 100644 ArmPkg/GccLto/liblto-arm.s
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-02 9:03 ` Ard Biesheuvel
@ 2016-08-02 10:57 ` Laszlo Ersek
2016-08-02 11:13 ` Ard Biesheuvel
2016-08-02 11:41 ` Shi, Steven
1 sibling, 1 reply; 30+ messages in thread
From: Laszlo Ersek @ 2016-08-02 10:57 UTC (permalink / raw)
To: Jordan Justen
Cc: Ard Biesheuvel, Shi, Steven, Zhu, Yonghong, Gao, Liming,
edk2-devel-01, Leif Lindholm
On 08/02/16 11:03, Ard Biesheuvel wrote:
> On 1 August 2016 at 10:01, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>> This v5 to introduce GCC5 is now a 8 piece series, including some
>> preparatory cleanup patches that allow all GCC4x and CLANG35 toolchains
>> to switch to using 'gcc' as the linker. This allows us to get rid of
>> the wrapper script to marshall ld arguments in order to make them
>> understandable by gcc, which is fragile and likely to cause problems in
>> the future.
>>
>> Since there appears to be a natural split between the 'legacy' GCC
>> toolchains UNIXGCC, ELFGCC, and CYGGCC[xASL], both in term of supported
>> architectures [IA32, X64, IPF] vs [IA32, X64, ARM, AARCH64], and in
>> terms of maintenance, these toolchains are not moved to using 'gcc' as
>> the linker, and instead, a new BUILDRULEFAMILY is introduced called GCCLD
>> that will retain the old behavior.
>>
>> The result is that GCC5 can align much more closely with its predecessors,
>> making the expected maintenance burden of supporting GCC back to v4.4
>> much lower.
>>
>> Changes since v4:
>> - added patch to use 'protected' visibility only for the libraries that
>> define the module entry points (_ModuleEntryPoint), to prevent them from
>> being optimized away by the LTO routines
>> - added Jordan's ack/RBs
>> - add some extra comments to tools_def.template (#8)
>>
>
> Thanks all. Committed as
>
> 1c63516075b3 BaseTools CLANG35: drop problematic use-movt and save-temps options
> ff54bcdf2e4e ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash
> and .note sections
> befb3ba51502 BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule
> family into GCCLD
> a1b8baccc30b BaseTools GCC: use 'gcc' as the linker command for GCC44 and later
> e1458aaded8e ArmPkg: add prebuilt glue binaries for GCC5 LTO support
> 7fd5d619806d BaseTools GCC: drop GNU notes section from EFI image
> 4a8466d4baba BaseTools GCC: introduce GCC5 toolchain to support GCC
> v5.x in LTO mode
>
> with Leif and Liming's R-b. I dropped patch #7, and instead made the
> visibility pragma conditional on whether LTO is disabled.
Re gcc-5, do we need a patch for "OvmfPkg/build.sh" now? See also
<https://tianocore.acgmultimedia.com/show_bug.cgi?id=62>.
Thanks
Laszlo
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-02 10:57 ` Laszlo Ersek
@ 2016-08-02 11:13 ` Ard Biesheuvel
0 siblings, 0 replies; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-02 11:13 UTC (permalink / raw)
To: Laszlo Ersek
Cc: Jordan Justen, Shi, Steven, Zhu, Yonghong, Gao, Liming,
edk2-devel-01, Leif Lindholm
On 2 August 2016 at 12:57, Laszlo Ersek <lersek@redhat.com> wrote:
> On 08/02/16 11:03, Ard Biesheuvel wrote:
>> On 1 August 2016 at 10:01, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>>> This v5 to introduce GCC5 is now a 8 piece series, including some
>>> preparatory cleanup patches that allow all GCC4x and CLANG35 toolchains
>>> to switch to using 'gcc' as the linker. This allows us to get rid of
>>> the wrapper script to marshall ld arguments in order to make them
>>> understandable by gcc, which is fragile and likely to cause problems in
>>> the future.
>>>
>>> Since there appears to be a natural split between the 'legacy' GCC
>>> toolchains UNIXGCC, ELFGCC, and CYGGCC[xASL], both in term of supported
>>> architectures [IA32, X64, IPF] vs [IA32, X64, ARM, AARCH64], and in
>>> terms of maintenance, these toolchains are not moved to using 'gcc' as
>>> the linker, and instead, a new BUILDRULEFAMILY is introduced called GCCLD
>>> that will retain the old behavior.
>>>
>>> The result is that GCC5 can align much more closely with its predecessors,
>>> making the expected maintenance burden of supporting GCC back to v4.4
>>> much lower.
>>>
>>> Changes since v4:
>>> - added patch to use 'protected' visibility only for the libraries that
>>> define the module entry points (_ModuleEntryPoint), to prevent them from
>>> being optimized away by the LTO routines
>>> - added Jordan's ack/RBs
>>> - add some extra comments to tools_def.template (#8)
>>>
>>
>> Thanks all. Committed as
>>
>> 1c63516075b3 BaseTools CLANG35: drop problematic use-movt and save-temps options
>> ff54bcdf2e4e ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash
>> and .note sections
>> befb3ba51502 BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule
>> family into GCCLD
>> a1b8baccc30b BaseTools GCC: use 'gcc' as the linker command for GCC44 and later
>> e1458aaded8e ArmPkg: add prebuilt glue binaries for GCC5 LTO support
>> 7fd5d619806d BaseTools GCC: drop GNU notes section from EFI image
>> 4a8466d4baba BaseTools GCC: introduce GCC5 toolchain to support GCC
>> v5.x in LTO mode
>>
>> with Leif and Liming's R-b. I dropped patch #7, and instead made the
>> visibility pragma conditional on whether LTO is disabled.
>
> Re gcc-5, do we need a patch for "OvmfPkg/build.sh" now? See also
> <https://tianocore.acgmultimedia.com/show_bug.cgi?id=62>.
>
Yes, I suppose so.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-02 9:03 ` Ard Biesheuvel
2016-08-02 10:57 ` Laszlo Ersek
@ 2016-08-02 11:41 ` Shi, Steven
2016-08-02 11:42 ` Ard Biesheuvel
1 sibling, 1 reply; 30+ messages in thread
From: Shi, Steven @ 2016-08-02 11:41 UTC (permalink / raw)
To: Ard Biesheuvel, Zhu, Yonghong, Gao, Liming, Justen, Jordan L,
edk2-devel-01
Cc: Leif Lindholm, Laszlo Ersek
Ard,
Thank you to check in GCC5!
Steven Shi
Intel\SSG\STO\UEFI Firmware
Tel: +86 021-61166522
iNet: 821-6522
> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Tuesday, August 02, 2016 5:03 PM
> To: Shi, Steven <steven.shi@intel.com>; Zhu, Yonghong
> <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>; Justen,
> Jordan L <jordan.l.justen@intel.com>; edk2-devel-01 <edk2-
> devel@lists.01.org>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>; Laszlo Ersek
> <lersek@redhat.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Subject: Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
>
> On 1 August 2016 at 10:01, Ard Biesheuvel <ard.biesheuvel@linaro.org>
> wrote:
> > This v5 to introduce GCC5 is now a 8 piece series, including some
> > preparatory cleanup patches that allow all GCC4x and CLANG35 toolchains
> > to switch to using 'gcc' as the linker. This allows us to get rid of
> > the wrapper script to marshall ld arguments in order to make them
> > understandable by gcc, which is fragile and likely to cause problems in
> > the future.
> >
> > Since there appears to be a natural split between the 'legacy' GCC
> > toolchains UNIXGCC, ELFGCC, and CYGGCC[xASL], both in term of
> supported
> > architectures [IA32, X64, IPF] vs [IA32, X64, ARM, AARCH64], and in
> > terms of maintenance, these toolchains are not moved to using 'gcc' as
> > the linker, and instead, a new BUILDRULEFAMILY is introduced called
> GCCLD
> > that will retain the old behavior.
> >
> > The result is that GCC5 can align much more closely with its predecessors,
> > making the expected maintenance burden of supporting GCC back to v4.4
> > much lower.
> >
> > Changes since v4:
> > - added patch to use 'protected' visibility only for the libraries that
> > define the module entry points (_ModuleEntryPoint), to prevent them
> from
> > being optimized away by the LTO routines
> > - added Jordan's ack/RBs
> > - add some extra comments to tools_def.template (#8)
> >
>
> Thanks all. Committed as
>
> 1c63516075b3 BaseTools CLANG35: drop problematic use-movt and save-
> temps options
> ff54bcdf2e4e ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash
> and .note sections
> befb3ba51502 BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule
> family into GCCLD
> a1b8baccc30b BaseTools GCC: use 'gcc' as the linker command for GCC44
> and later
> e1458aaded8e ArmPkg: add prebuilt glue binaries for GCC5 LTO support
> 7fd5d619806d BaseTools GCC: drop GNU notes section from EFI image
> 4a8466d4baba BaseTools GCC: introduce GCC5 toolchain to support GCC
> v5.x in LTO mode
>
> with Leif and Liming's R-b. I dropped patch #7, and instead made the
> visibility pragma conditional on whether LTO is disabled.
>
> --
> Ard.
>
>
> > Changes since v3:
> > - like Steven does in his GCC5LTO patch, add -fno-builtin to IA32 and X64
> > CC_FLAGS; this addresses a build issue reported by Liming
> > - add -Os the the linker flags as well, for AARCH64 this does not seem to
> make
> > a difference, but it is arguably correct since the LTO processing at link
> > time involves code generation as well
> > - add Laszlo's ack to #2
> > - new patch #6 to omit the autogenerated build-id from the PE/COFF binary
> >
> > Changes since v2:
> > - add license headers to LTO glue files for ARM and AARCH64 (#5)
> > - get rid of lto-ld-wrapper script
> >
> > Ard Biesheuvel (8):
> > BaseTools CLANG35: drop problematic use-movt and save-temps options
> > ArmVirtPkg/ArmVirtPrePiUniCoreRelocatable: ignore .hash and .note
> > sections
> > BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into
> > GCCLD
> > BaseTools GCC: use 'gcc' as the linker command for GCC44 and later
> > ArmPkg: add prebuilt glue binaries for GCC5 LTO support
> > BaseTools GCC: drop GNU notes section from EFI image
> > MdePkg GCC/X64: avoid 'hidden' visibility for module entry points
> > BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO
> > mode
> >
> > ArmPkg/GccLto/liblto-aarch64.a | Bin 0 -> 1016
> bytes
> > ArmPkg/GccLto/liblto-aarch64.s | 27 ++
> > ArmPkg/GccLto/liblto-arm.a | Bin 0 -> 2096 bytes
> > ArmPkg/GccLto/liblto-arm.s | 61 ++++
> > ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf | 2 +-
> > ArmVirtPkg/PrePi/Scripts/PrePi-PIE.lds | 3 +
> > BaseTools/Conf/build_rule.template | 31 +-
> > BaseTools/Conf/tools_def.template | 350
> +++++++++++++++-----
> > BaseTools/Scripts/GccBase.lds | 6 +
> > EmulatorPkg/Unix/Host/Host.inf | 6 +-
> > MdePkg/Include/X64/ProcessorBind.h | 9 +-
> > MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf | 2 +
> > MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf | 2 +
> > MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf | 2 +
> > MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf |
> 2 +
> > MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf | 2 +
> > 16 files changed, 396 insertions(+), 109 deletions(-)
> > create mode 100644 ArmPkg/GccLto/liblto-aarch64.a
> > create mode 100644 ArmPkg/GccLto/liblto-aarch64.s
> > create mode 100644 ArmPkg/GccLto/liblto-arm.a
> > create mode 100644 ArmPkg/GccLto/liblto-arm.s
> >
> > --
> > 2.7.4
> >
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-02 11:41 ` Shi, Steven
@ 2016-08-02 11:42 ` Ard Biesheuvel
2016-08-02 13:55 ` Michael Zimmermann
0 siblings, 1 reply; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-02 11:42 UTC (permalink / raw)
To: Shi, Steven
Cc: Zhu, Yonghong, Gao, Liming, Justen, Jordan L, edk2-devel-01,
Leif Lindholm, Laszlo Ersek
On 2 August 2016 at 13:41, Shi, Steven <steven.shi@intel.com> wrote:
> Ard,
> Thank you to check in GCC5!
>
My pleasure. Thanks to you for the comments, discussion and review feedback.
--
Ard.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-02 11:42 ` Ard Biesheuvel
@ 2016-08-02 13:55 ` Michael Zimmermann
2016-08-02 13:56 ` Ard Biesheuvel
0 siblings, 1 reply; 30+ messages in thread
From: Michael Zimmermann @ 2016-08-02 13:55 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Shi, Steven, Justen, Jordan L, edk2-devel-01, Leif Lindholm,
Gao, Liming, Laszlo Ersek
btw, gcc6 seems to work fine too with these patches(it did with the GCC49
configs too on both ARM and x86/x64).
Thanks
Michael
On Tue, Aug 2, 2016 at 1:42 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
wrote:
> On 2 August 2016 at 13:41, Shi, Steven <steven.shi@intel.com> wrote:
> > Ard,
> > Thank you to check in GCC5!
> >
>
> My pleasure. Thanks to you for the comments, discussion and review
> feedback.
>
> --
> Ard.
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-02 13:55 ` Michael Zimmermann
@ 2016-08-02 13:56 ` Ard Biesheuvel
2016-08-02 14:39 ` Michael Zimmermann
0 siblings, 1 reply; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-02 13:56 UTC (permalink / raw)
To: Michael Zimmermann
Cc: Shi, Steven, Justen, Jordan L, edk2-devel-01, Leif Lindholm,
Gao, Liming, Laszlo Ersek
On 2 August 2016 at 15:55, Michael Zimmermann <sigmaepsilon92@gmail.com> wrote:
> btw, gcc6 seems to work fine too with these patches(it did with the GCC49
> configs too on both ARM and x86/x64).
>
Thanks for the data points. Do you see any warnings during the build?
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-02 13:56 ` Ard Biesheuvel
@ 2016-08-02 14:39 ` Michael Zimmermann
2016-08-02 14:46 ` Michael Zimmermann
2016-08-02 14:47 ` Ard Biesheuvel
0 siblings, 2 replies; 30+ messages in thread
From: Michael Zimmermann @ 2016-08-02 14:39 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Shi, Steven, Justen, Jordan L, edk2-devel-01, Leif Lindholm,
Gao, Liming, Laszlo Ersek
Sry for the late reply but I tried your latest gcc-lto branch to make sure
my answers are still correct.
I tested it with all configurations(StdLib:X64/ARM, Ovmf:X64,
ArmVirtPkg:ARM with both RELEASE and DEBUG).
In StdLib are many warnings actually. That's because
of -Wunused-const-variable and -Wmisleading-indentation.
Also I had to apply the commit to fix 'Unsupported ELF EM_X86_64 relocation
0x4.' for X64.
'-b RELEASE -a ARM -t GCC5 -p AppPkg/AppPkg.dsc' is the only configuration
I can't get to compile with gcc6(DEBUG works):
/tmp/ccYJi1bO.ltrans0.ltrans.o: In function `memmove':
<artificial>:(.text+0x3670): multiple definition of `memmove'
/media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/CompilerIntrinsicsLib.lib(memmove.obj):(.text+0x0):
first defined here
/tmp/ccYJi1bO.ltrans0.ltrans.o: In function `memset':
<artificial>:(.text+0x3674): multiple definition of `memset'
/media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/CompilerIntrinsicsLib.lib(memset.obj):(.text+0x10):
first defined here
/media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
printf.obj: plugin needed to handle lto object
/media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
puts.obj: plugin needed to handle lto object
/media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
internal error
/media/Data/repositories/git/abe/_build/snapshots/binutils-gdb.git~linaro_binutils-2_26-branch/ld/ldlang.c
6299
collect2: error: ld returned 1 exit status
make: *** [GNUmakefile:417:
/media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/AppPkg/Applications/Main/Main/DEBUG/Main.dll]
Error 1
Also, I only did compilation tests, I didn't try to run any of the produced
binaries.
this is the fixed branch:
https://github.com/M1cha/edk2/commits/edk2-master-gcc6
it's based on your gcc5-lto-v6 branch.
Thanks
Michael
On Tue, Aug 2, 2016 at 3:56 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
wrote:
> On 2 August 2016 at 15:55, Michael Zimmermann <sigmaepsilon92@gmail.com>
> wrote:
> > btw, gcc6 seems to work fine too with these patches(it did with the GCC49
> > configs too on both ARM and x86/x64).
> >
>
> Thanks for the data points. Do you see any warnings during the build?
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-02 14:39 ` Michael Zimmermann
@ 2016-08-02 14:46 ` Michael Zimmermann
2016-08-02 14:51 ` Michael Zimmermann
2016-08-02 14:47 ` Ard Biesheuvel
1 sibling, 1 reply; 30+ messages in thread
From: Michael Zimmermann @ 2016-08-02 14:46 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Shi, Steven, Justen, Jordan L, edk2-devel-01, Leif Lindholm,
Gao, Liming, Laszlo Ersek
sry but I have to retest everything since I aciidentally checked out a
wrong revision.
will report back later.
On Tue, Aug 2, 2016 at 4:39 PM, Michael Zimmermann <sigmaepsilon92@gmail.com
> wrote:
> Sry for the late reply but I tried your latest gcc-lto branch to make sure
> my answers are still correct.
> I tested it with all configurations(StdLib:X64/ARM, Ovmf:X64,
> ArmVirtPkg:ARM with both RELEASE and DEBUG).
> In StdLib are many warnings actually. That's because
> of -Wunused-const-variable and -Wmisleading-indentation.
> Also I had to apply the commit to fix 'Unsupported ELF EM_X86_64
> relocation 0x4.' for X64.
>
> '-b RELEASE -a ARM -t GCC5 -p AppPkg/AppPkg.dsc' is the only configuration
> I can't get to compile with gcc6(DEBUG works):
> /tmp/ccYJi1bO.ltrans0.ltrans.o: In function `memmove':
> <artificial>:(.text+0x3670): multiple definition of `memmove'
> /media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/CompilerIntrinsicsLib.lib(memmove.obj):(.text+0x0):
> first defined here
> /tmp/ccYJi1bO.ltrans0.ltrans.o: In function `memset':
> <artificial>:(.text+0x3674): multiple definition of `memset'
> /media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/CompilerIntrinsicsLib.lib(memset.obj):(.text+0x10):
> first defined here
>
> /media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
> printf.obj: plugin needed to handle lto object
>
> /media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
> puts.obj: plugin needed to handle lto object
>
> /media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
> internal error
> /media/Data/repositories/git/abe/_build/snapshots/binutils-gdb.git~linaro_binutils-2_26-branch/ld/ldlang.c
> 6299
> collect2: error: ld returned 1 exit status
> make: *** [GNUmakefile:417:
> /media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/AppPkg/Applications/Main/Main/DEBUG/Main.dll]
> Error 1
>
> Also, I only did compilation tests, I didn't try to run any of the
> produced binaries.
>
> this is the fixed branch:
> https://github.com/M1cha/edk2/commits/edk2-master-gcc6
> it's based on your gcc5-lto-v6 branch.
>
> Thanks
> Michael
>
> On Tue, Aug 2, 2016 at 3:56 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org>
> wrote:
>
>> On 2 August 2016 at 15:55, Michael Zimmermann <sigmaepsilon92@gmail.com>
>> wrote:
>> > btw, gcc6 seems to work fine too with these patches(it did with the
>> GCC49
>> > configs too on both ARM and x86/x64).
>> >
>>
>> Thanks for the data points. Do you see any warnings during the build?
>>
>
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-02 14:46 ` Michael Zimmermann
@ 2016-08-02 14:51 ` Michael Zimmermann
0 siblings, 0 replies; 30+ messages in thread
From: Michael Zimmermann @ 2016-08-02 14:51 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Shi, Steven, Justen, Jordan L, edk2-devel-01, Leif Lindholm,
Gao, Liming, Laszlo Ersek
> sry but I have to retest everything since I aciidentally checked out a
wrong revision.
will report back later.
ignore this, everything in my report was correct. got confused with
CommitDate vs AuthorDate.
> Only 0x4 or 0x9 or others as well? This is relevent since 0x4 is a PLT
relocation which can be fixed up easily. The GOT based ones are
trickier since they involve a GOT entry with an absolute symbol
address that needs to be fixed up by the PE/COFF loader
Only 0x4.
> Interesting. I wonder where the first memmove resp. memset are coming
from. Are you linking with libgcc are sth like that?
I was able to fix memmove with this patch:
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.S
b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.S
index 79f95b0..5833814 100644
--- a/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.S
+++ b/ArmPkg/Library/CompilerIntrinsicsLib/Arm/memmove.S
@@ -14,7 +14,6 @@
.text
.align 2
- GCC_ASM_EXPORT (memmove)
# VOID
# EFIAPI
no idea about memset, but when I hacked it away by just removing the export
from the CompilerIntrinsicsLib, the error was gone, but the 'plugin needed
to handle lto object' errors were still there.
Thanks
Michael
On Tue, Aug 2, 2016 at 4:46 PM, Michael Zimmermann <sigmaepsilon92@gmail.com
> wrote:
> sry but I have to retest everything since I aciidentally checked out a
> wrong revision.
> will report back later.
>
> On Tue, Aug 2, 2016 at 4:39 PM, Michael Zimmermann <
> sigmaepsilon92@gmail.com> wrote:
>
>> Sry for the late reply but I tried your latest gcc-lto branch to make
>> sure my answers are still correct.
>> I tested it with all configurations(StdLib:X64/ARM, Ovmf:X64,
>> ArmVirtPkg:ARM with both RELEASE and DEBUG).
>> In StdLib are many warnings actually. That's because
>> of -Wunused-const-variable and -Wmisleading-indentation.
>> Also I had to apply the commit to fix 'Unsupported ELF EM_X86_64
>> relocation 0x4.' for X64.
>>
>> '-b RELEASE -a ARM -t GCC5 -p AppPkg/AppPkg.dsc' is the only
>> configuration I can't get to compile with gcc6(DEBUG works):
>> /tmp/ccYJi1bO.ltrans0.ltrans.o: In function `memmove':
>> <artificial>:(.text+0x3670): multiple definition of `memmove'
>> /media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/CompilerIntrinsicsLib.lib(memmove.obj):(.text+0x0):
>> first defined here
>> /tmp/ccYJi1bO.ltrans0.ltrans.o: In function `memset':
>> <artificial>:(.text+0x3674): multiple definition of `memset'
>> /media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/CompilerIntrinsicsLib.lib(memset.obj):(.text+0x10):
>> first defined here
>>
>> /media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
>> printf.obj: plugin needed to handle lto object
>>
>> /media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
>> puts.obj: plugin needed to handle lto object
>>
>> /media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
>> internal error
>> /media/Data/repositories/git/abe/_build/snapshots/binutils-gdb.git~linaro_binutils-2_26-branch/ld/ldlang.c
>> 6299
>> collect2: error: ld returned 1 exit status
>> make: *** [GNUmakefile:417:
>> /media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/AppPkg/Applications/Main/Main/DEBUG/Main.dll]
>> Error 1
>>
>> Also, I only did compilation tests, I didn't try to run any of the
>> produced binaries.
>>
>> this is the fixed branch:
>> https://github.com/M1cha/edk2/commits/edk2-master-gcc6
>> it's based on your gcc5-lto-v6 branch.
>>
>> Thanks
>> Michael
>>
>> On Tue, Aug 2, 2016 at 3:56 PM, Ard Biesheuvel <ard.biesheuvel@linaro.org
>> > wrote:
>>
>>> On 2 August 2016 at 15:55, Michael Zimmermann <sigmaepsilon92@gmail.com>
>>> wrote:
>>> > btw, gcc6 seems to work fine too with these patches(it did with the
>>> GCC49
>>> > configs too on both ARM and x86/x64).
>>> >
>>>
>>> Thanks for the data points. Do you see any warnings during the build?
>>>
>>
>>
>
^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH v5 0/8] BaseTools: add support for GCC5 in LTO mode
2016-08-02 14:39 ` Michael Zimmermann
2016-08-02 14:46 ` Michael Zimmermann
@ 2016-08-02 14:47 ` Ard Biesheuvel
1 sibling, 0 replies; 30+ messages in thread
From: Ard Biesheuvel @ 2016-08-02 14:47 UTC (permalink / raw)
To: Michael Zimmermann
Cc: Shi, Steven, Justen, Jordan L, edk2-devel-01, Leif Lindholm,
Gao, Liming, Laszlo Ersek
On 2 August 2016 at 16:39, Michael Zimmermann <sigmaepsilon92@gmail.com> wrote:
> Sry for the late reply but I tried your latest gcc-lto branch to make sure
> my answers are still correct.
> I tested it with all configurations(StdLib:X64/ARM, Ovmf:X64, ArmVirtPkg:ARM
> with both RELEASE and DEBUG).
> In StdLib are many warnings actually. That's because of
> -Wunused-const-variable and -Wmisleading-indentation.
> Also I had to apply the commit to fix 'Unsupported ELF EM_X86_64 relocation
> 0x4.' for X64.
>
Only 0x4 or 0x9 or others as well? This is relevent since 0x4 is a PLT
relocation which can be fixed up easily. The GOT based ones are
trickier since they involve a GOT entry with an absolute symbol
address that needs to be fixed up by the PE/COFF loader
> '-b RELEASE -a ARM -t GCC5 -p AppPkg/AppPkg.dsc' is the only configuration I
> can't get to compile with gcc6(DEBUG works):
> /tmp/ccYJi1bO.ltrans0.ltrans.o: In function `memmove':
> <artificial>:(.text+0x3670): multiple definition of `memmove'
> /media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/CompilerIntrinsicsLib.lib(memmove.obj):(.text+0x0):
> first defined here
> /tmp/ccYJi1bO.ltrans0.ltrans.o: In function `memset':
> <artificial>:(.text+0x3674): multiple definition of `memset'
> /media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/CompilerIntrinsicsLib.lib(memset.obj):(.text+0x10):
> first defined here
Interesting. I wonder where the first memmove resp. memset are coming
from. Are you linking with libgcc are sth like that?
> /media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
> printf.obj: plugin needed to handle lto object
> /media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
> puts.obj: plugin needed to handle lto object
> /media/Data/repositories/git/efidroid/prebuilts/gcc/linux-x86/arm/gcc-linaro-6.1.1~linaro-gcc-6-branch@f3888e76-20160721-x86_64_arm-eabi/bin/../lib/gcc/arm-eabi/6.1.1/../../../../arm-eabi/bin/ld:
> internal error
> /media/Data/repositories/git/abe/_build/snapshots/binutils-gdb.git~linaro_binutils-2_26-branch/ld/ldlang.c
> 6299
> collect2: error: ld returned 1 exit status
> make: *** [GNUmakefile:417:
> /media/Data/repositories/git/efidroid/testing/linuxtoolchain/edk2/Build/AppPkg/RELEASE_GCC5/ARM/AppPkg/Applications/Main/Main/DEBUG/Main.dll]
> Error 1
>
Not sure what's going on here ...
> Also, I only did compilation tests, I didn't try to run any of the produced
> binaries.
>
> this is the fixed branch:
> https://github.com/M1cha/edk2/commits/edk2-master-gcc6
> it's based on your gcc5-lto-v6 branch.
>
Thanks for the report. I will look into this.
^ permalink raw reply [flat|nested] 30+ messages in thread