summaryrefslogtreecommitdiffstats
path: root/BaseTools/Conf/build_rule.template
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2016-07-23 10:19:46 +0200
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2016-08-02 08:40:43 +0200
commita1b8baccc30ba7c3911359e271b0e0a3ef56d501 (patch)
tree7a9f65043fb5684ee0357e4732cc18beee6b8286 /BaseTools/Conf/build_rule.template
parentbefb3ba5150200ce94044c8c27e6e812d8e89680 (diff)
downloadedk2-a1b8baccc30ba7c3911359e271b0e0a3ef56d501.tar.gz
edk2-a1b8baccc30ba7c3911359e271b0e0a3ef56d501.tar.bz2
edk2-a1b8baccc30ba7c3911359e271b0e0a3ef56d501.zip
BaseTools GCC: use 'gcc' as the linker command for GCC44 and later
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> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Conf/build_rule.template')
-rw-r--r--BaseTools/Conf/build_rule.template11
1 files changed, 9 insertions, 2 deletions
diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template
index 3fea4f4561..eb4ae749fd 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>