[edk2,v3,3/6] BaseTools UNIXGCC ELFGCC CYGGCC: clone GCC build rule family into GCCLD

Message ID 1469264601-31356-4-git-send-email-ard.biesheuvel@linaro.org
State Superseded
Headers show

Commit Message

Ard Biesheuvel July 23, 2016, 9:03 a.m.
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>

---
 BaseTools/Conf/build_rule.template | 28 ++++++++++----------
 BaseTools/Conf/tools_def.template  |  4 +++
 2 files changed, 18 insertions(+), 14 deletions(-)

-- 
2.7.4

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

Comments

Ard Biesheuvel July 26, 2016, 7:19 a.m. | #1
On 25 July 2016 at 22:56, Jordan Justen <jordan.l.justen@intel.com> wrote:
> I think you should make the build_rule changes in one patch, and the

> tools_def changes in the second. GCCLD, in this patch, will not work

> for using GCC as the linker.

>


Not sure I understand what you mean. After his patch, GCC and GCCLD
are 100% equivalent, and any toolchains could use either and get the
exact same result, The gcc vs ld binary changes are in the next
patch(es)

-- 
Ard.

> On 2016-07-23 02:03:18, Ard Biesheuvel wrote:

>> 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>

>> ---

>>  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

>>

>> _______________________________________________

>> 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
Ard Biesheuvel July 26, 2016, 7:50 a.m. | #2
On 26 July 2016 at 09:40, Jordan Justen <jordan.l.justen@intel.com> wrote:
> On 2016-07-26 00:19:20, Ard Biesheuvel wrote:

>> On 25 July 2016 at 22:56, Jordan Justen <jordan.l.justen@intel.com> wrote:

>> > I think you should make the build_rule changes in one patch, and the

>> > tools_def changes in the second. GCCLD, in this patch, will not work

>> > for using GCC as the linker.

>> >

>>

>> Not sure I understand what you mean. After his patch, GCC and GCCLD

>> are 100% equivalent, and any toolchains could use either and get the

>> exact same result, The gcc vs ld binary changes are in the next

>> patch(es)

>

> I meant that I don't think we need to make GCCLD equivalent at first.

>

> Instead, I suggest we add GCCLD with the -Wl changes, but don't set

> any toolchain to use it.

>

> Then we update the tools_def in a separate patch to make some

> toolchains use GCCLD, and at the same time change their linker flags

> to add -Wl.

>

> Basically, pull the build_rule changes into this patch from the next

> patch, and push the tools_def changes from this patch into the next

> patch.

>


GCCLD will mean 'use ld as linker' not 'use gcc as linker', and is
introduced in this patch so the legacy GCC toolchains don't need to be
updated. So the tools_def changes are appropriate here, they introduce
GCCLD and move the legacy toolchains over to use it so that subsequent
changes to the original GCC build rule family will not affect them.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Patch

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