[edk2] [Patch] BaseTools: Update tools_def.template to add -fno-builtin in GCC tool chain

Liming Gao posted 1 patch 7 years, 7 months ago
Failed in applying to current master (apply log)
BaseTools/Conf/tools_def.template | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
[edk2] [Patch] BaseTools: Update tools_def.template to add -fno-builtin in GCC tool chain
Posted by Liming Gao 7 years, 7 months ago
Now, -fno-builtin option is added for the specific GCC tool chain.
It is a generic option. It can be moved to common GCC option to keep
the consistent compiler option.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 BaseTools/Conf/tools_def.template | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 2c5cd58089..14ecfedab1 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4335,13 +4335,13 @@ DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N
 RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG   =
 NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug
 
-DEFINE GCC_ALL_CC_FLAGS            = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
+DEFINE GCC_ALL_CC_FLAGS            = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
 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 -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -mthumb -mfloat-abi=soft
+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_ARM_CC_XIPFLAGS         = -mno-unaligned-access
-DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections -fdata-sections -fno-builtin -Wno-address -fno-asynchronous-unwind-tables -fno-pic
+DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-pic
 DEFINE GCC_AARCH64_CC_XIPFLAGS     = -mstrict-align
 DEFINE GCC_DLINK_FLAGS_COMMON      = -nostdlib --pie
 DEFINE GCC_DLINK2_FLAGS_COMMON     = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
@@ -4368,7 +4368,7 @@ DEFINE GCC_IPF_RC_FLAGS            = -I binary -O elf64-ia64-little   -B ia64
 DEFINE GCC_ARM_RC_FLAGS            = -I binary -O elf32-littlearm     -B arm     --rename-section .data=.hii
 DEFINE GCC_AARCH64_RC_FLAGS        = -I binary -O elf64-littleaarch64 -B aarch64 --rename-section .data=.hii
 
-DEFINE GCC44_ALL_CC_FLAGS            = -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
+DEFINE GCC44_ALL_CC_FLAGS            = -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -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))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables
 DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
@@ -4471,8 +4471,8 @@ 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) -fno-builtin
-DEFINE GCC5_X64_CC_FLAGS             = DEF(GCC49_X64_CC_FLAGS) -fno-builtin
+DEFINE GCC5_IA32_CC_FLAGS            = DEF(GCC49_IA32_CC_FLAGS)
+DEFINE GCC5_X64_CC_FLAGS             = DEF(GCC49_X64_CC_FLAGS)
 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)
@@ -5512,7 +5512,7 @@ DEFINE CLANG38_X64_PREFIX           = ENV(CLANG38_BIN)
 DEFINE CLANG38_IA32_TARGET          = -target i686-pc-linux-gnu
 DEFINE CLANG38_X64_TARGET           = -target x86_64-pc-linux-gnu
 
-DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -fno-builtin -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float  -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare
+DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float  -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare
 
 ###########################
 # CLANG38 IA32 definitions
-- 
2.11.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTools: Update tools_def.template to add -fno-builtin in GCC tool chain
Posted by Laszlo Ersek 7 years, 7 months ago
On 04/06/17 02:45, Liming Gao wrote:
> Now, -fno-builtin option is added for the specific GCC tool chain.
> It is a generic option. It can be moved to common GCC option to keep
> the consistent compiler option.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Please don't add "Signed-off-by" tags for other people. That tag should
only come from people with actual authorship on the patch.

Instead, in this case,

Suggested-by: Laszlo Ersek <lersek@redhat.com>

would be appropriate (and welcome too :) ).

I'll check this patch in more detail later.

Thanks,
Laszlo

> ---
>  BaseTools/Conf/tools_def.template | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
> index 2c5cd58089..14ecfedab1 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -4335,13 +4335,13 @@ DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N
>  RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG   =
>  NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug
>  
> -DEFINE GCC_ALL_CC_FLAGS            = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
> +DEFINE GCC_ALL_CC_FLAGS            = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
>  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 -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -mthumb -mfloat-abi=soft
> +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_ARM_CC_XIPFLAGS         = -mno-unaligned-access
> -DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections -fdata-sections -fno-builtin -Wno-address -fno-asynchronous-unwind-tables -fno-pic
> +DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-pic
>  DEFINE GCC_AARCH64_CC_XIPFLAGS     = -mstrict-align
>  DEFINE GCC_DLINK_FLAGS_COMMON      = -nostdlib --pie
>  DEFINE GCC_DLINK2_FLAGS_COMMON     = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
> @@ -4368,7 +4368,7 @@ DEFINE GCC_IPF_RC_FLAGS            = -I binary -O elf64-ia64-little   -B ia64
>  DEFINE GCC_ARM_RC_FLAGS            = -I binary -O elf32-littlearm     -B arm     --rename-section .data=.hii
>  DEFINE GCC_AARCH64_RC_FLAGS        = -I binary -O elf64-littleaarch64 -B aarch64 --rename-section .data=.hii
>  
> -DEFINE GCC44_ALL_CC_FLAGS            = -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
> +DEFINE GCC44_ALL_CC_FLAGS            = -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -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))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables
>  DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
> @@ -4471,8 +4471,8 @@ 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) -fno-builtin
> -DEFINE GCC5_X64_CC_FLAGS             = DEF(GCC49_X64_CC_FLAGS) -fno-builtin
> +DEFINE GCC5_IA32_CC_FLAGS            = DEF(GCC49_IA32_CC_FLAGS)
> +DEFINE GCC5_X64_CC_FLAGS             = DEF(GCC49_X64_CC_FLAGS)
>  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)
> @@ -5512,7 +5512,7 @@ DEFINE CLANG38_X64_PREFIX           = ENV(CLANG38_BIN)
>  DEFINE CLANG38_IA32_TARGET          = -target i686-pc-linux-gnu
>  DEFINE CLANG38_X64_TARGET           = -target x86_64-pc-linux-gnu
>  
> -DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -fno-builtin -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float  -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare
> +DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float  -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare
>  
>  ###########################
>  # CLANG38 IA32 definitions
> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTools: Update tools_def.template to add -fno-builtin in GCC tool chain
Posted by Laszlo Ersek 7 years, 7 months ago
On 04/06/17 02:57, Laszlo Ersek wrote:
> On 04/06/17 02:45, Liming Gao wrote:
>> Now, -fno-builtin option is added for the specific GCC tool chain.
>> It is a generic option. It can be moved to common GCC option to keep
>> the consistent compiler option.
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Liming Gao <liming.gao@intel.com>
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> 
> Please don't add "Signed-off-by" tags for other people. That tag should
> only come from people with actual authorship on the patch.
> 
> Instead, in this case,
> 
> Suggested-by: Laszlo Ersek <lersek@redhat.com>
> 
> would be appropriate (and welcome too :) ).
> 
> I'll check this patch in more detail later.

With the above commit message update:

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

I also tested this, with OVMF (Ia32, Ia32X64, X64), using gcc-4.8 (GCC48
toolchain), and with ArmVirtQemu (AARCH64), using gcc-6.1.1 (GCC5
toolchain).

Tested-by: Laszlo Ersek <lersek@redhat.com>

Thanks!
Laszlo

> 
>> ---
>>  BaseTools/Conf/tools_def.template | 14 +++++++-------
>>  1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
>> index 2c5cd58089..14ecfedab1 100755
>> --- a/BaseTools/Conf/tools_def.template
>> +++ b/BaseTools/Conf/tools_def.template
>> @@ -4335,13 +4335,13 @@ DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N
>>  RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG   =
>>  NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug
>>  
>> -DEFINE GCC_ALL_CC_FLAGS            = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
>> +DEFINE GCC_ALL_CC_FLAGS            = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
>>  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 -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -mthumb -mfloat-abi=soft
>> +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_ARM_CC_XIPFLAGS         = -mno-unaligned-access
>> -DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections -fdata-sections -fno-builtin -Wno-address -fno-asynchronous-unwind-tables -fno-pic
>> +DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-pic
>>  DEFINE GCC_AARCH64_CC_XIPFLAGS     = -mstrict-align
>>  DEFINE GCC_DLINK_FLAGS_COMMON      = -nostdlib --pie
>>  DEFINE GCC_DLINK2_FLAGS_COMMON     = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
>> @@ -4368,7 +4368,7 @@ DEFINE GCC_IPF_RC_FLAGS            = -I binary -O elf64-ia64-little   -B ia64
>>  DEFINE GCC_ARM_RC_FLAGS            = -I binary -O elf32-littlearm     -B arm     --rename-section .data=.hii
>>  DEFINE GCC_AARCH64_RC_FLAGS        = -I binary -O elf64-littleaarch64 -B aarch64 --rename-section .data=.hii
>>  
>> -DEFINE GCC44_ALL_CC_FLAGS            = -g -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
>> +DEFINE GCC44_ALL_CC_FLAGS            = -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -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))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables
>>  DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
>> @@ -4471,8 +4471,8 @@ 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) -fno-builtin
>> -DEFINE GCC5_X64_CC_FLAGS             = DEF(GCC49_X64_CC_FLAGS) -fno-builtin
>> +DEFINE GCC5_IA32_CC_FLAGS            = DEF(GCC49_IA32_CC_FLAGS)
>> +DEFINE GCC5_X64_CC_FLAGS             = DEF(GCC49_X64_CC_FLAGS)
>>  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)
>> @@ -5512,7 +5512,7 @@ DEFINE CLANG38_X64_PREFIX           = ENV(CLANG38_BIN)
>>  DEFINE CLANG38_IA32_TARGET          = -target i686-pc-linux-gnu
>>  DEFINE CLANG38_X64_TARGET           = -target x86_64-pc-linux-gnu
>>  
>> -DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -fno-builtin -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float  -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare
>> +DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float  -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare
>>  
>>  ###########################
>>  # CLANG38 IA32 definitions
>>
> 
> _______________________________________________
> 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
Re: [edk2] [Patch] BaseTools: Update tools_def.template to add -fno-builtin in GCC tool chain
Posted by Gao, Liming 7 years, 7 months ago
Thanks! I will update the commit message and push it. 

>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>Laszlo Ersek
>Sent: Thursday, April 06, 2017 3:39 PM
>To: Gao, Liming <liming.gao@intel.com>; edk2-devel@lists.01.org
>Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>Subject: Re: [edk2] [Patch] BaseTools: Update tools_def.template to add -
>fno-builtin in GCC tool chain
>
>On 04/06/17 02:57, Laszlo Ersek wrote:
>> On 04/06/17 02:45, Liming Gao wrote:
>>> Now, -fno-builtin option is added for the specific GCC tool chain.
>>> It is a generic option. It can be moved to common GCC option to keep
>>> the consistent compiler option.
>>>
>>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
>>> Contributed-under: TianoCore Contribution Agreement 1.0
>>> Signed-off-by: Liming Gao <liming.gao@intel.com>
>>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>>
>> Please don't add "Signed-off-by" tags for other people. That tag should
>> only come from people with actual authorship on the patch.
>>
>> Instead, in this case,
>>
>> Suggested-by: Laszlo Ersek <lersek@redhat.com>
>>
>> would be appropriate (and welcome too :) ).
>>
>> I'll check this patch in more detail later.
>
>With the above commit message update:
>
>Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>
>I also tested this, with OVMF (Ia32, Ia32X64, X64), using gcc-4.8 (GCC48
>toolchain), and with ArmVirtQemu (AARCH64), using gcc-6.1.1 (GCC5
>toolchain).
>
>Tested-by: Laszlo Ersek <lersek@redhat.com>
>
>Thanks!
>Laszlo
>
>>
>>> ---
>>>  BaseTools/Conf/tools_def.template | 14 +++++++-------
>>>  1 file changed, 7 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/BaseTools/Conf/tools_def.template
>b/BaseTools/Conf/tools_def.template
>>> index 2c5cd58089..14ecfedab1 100755
>>> --- a/BaseTools/Conf/tools_def.template
>>> +++ b/BaseTools/Conf/tools_def.template
>>> @@ -4335,13 +4335,13 @@ DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG     = --
>add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N
>>>  RELEASE_*_*_OBJCOPY_ADDDEBUGFLAG   =
>>>  NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-
>debuglink=$(DEBUG_DIR)/$(MODULE_NAME).debug
>>>
>>> -DEFINE GCC_ALL_CC_FLAGS            = -g -Os -fshort-wchar -fno-strict-
>aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
>>> +DEFINE GCC_ALL_CC_FLAGS            = -g -Os -fshort-wchar -fno-builtin -fno-
>strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-
>common
>>>  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 -funsigned-char -ffunction-sections -
>fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -mthumb -
>mfloat-abi=soft
>>> +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_ARM_CC_XIPFLAGS         = -mno-unaligned-access
>>> -DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -
>mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-
>sections -fdata-sections -fno-builtin -Wno-address -fno-asynchronous-
>unwind-tables -fno-pic
>>> +DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -
>mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-
>sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -
>fno-pic
>>>  DEFINE GCC_AARCH64_CC_XIPFLAGS     = -mstrict-align
>>>  DEFINE GCC_DLINK_FLAGS_COMMON      = -nostdlib --pie
>>>  DEFINE GCC_DLINK2_FLAGS_COMMON     = -Wl,--
>script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
>>> @@ -4368,7 +4368,7 @@ DEFINE GCC_IPF_RC_FLAGS            = -I binary -O
>elf64-ia64-little   -B ia64
>>>  DEFINE GCC_ARM_RC_FLAGS            = -I binary -O elf32-littlearm     -B arm
>--rename-section .data=.hii
>>>  DEFINE GCC_AARCH64_RC_FLAGS        = -I binary -O elf64-littleaarch64 -B
>aarch64 --rename-section .data=.hii
>>>
>>> -DEFINE GCC44_ALL_CC_FLAGS            = -g -fshort-wchar -fno-strict-aliasing
>-Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include
>AutoGen.h -fno-common -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
>>> +DEFINE GCC44_ALL_CC_FLAGS            = -g -fshort-wchar -fno-builtin -fno-
>strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-
>sections -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))" -maccumulate-
>outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-
>asynchronous-unwind-tables
>>>  DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-
>sections -z common-page-size=0x20
>>> @@ -4471,8 +4471,8 @@ 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) -fno-
>builtin
>>> -DEFINE GCC5_X64_CC_FLAGS             = DEF(GCC49_X64_CC_FLAGS) -fno-
>builtin
>>> +DEFINE GCC5_IA32_CC_FLAGS            = DEF(GCC49_IA32_CC_FLAGS)
>>> +DEFINE GCC5_X64_CC_FLAGS             = DEF(GCC49_X64_CC_FLAGS)
>>>  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)
>>> @@ -5512,7 +5512,7 @@ DEFINE CLANG38_X64_PREFIX           =
>ENV(CLANG38_BIN)
>>>  DEFINE CLANG38_IA32_TARGET          = -target i686-pc-linux-gnu
>>>  DEFINE CLANG38_X64_TARGET           = -target x86_64-pc-linux-gnu
>>>
>>> -DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) -
>Wno-empty-body -fno-stack-protector -fno-builtin -mms-bitfields -Wno-
>address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-
>unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-
>incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-
>sse -mno-mmx -msoft-float -mno-implicit-float  -ftrap-
>function=undefined_behavior_has_been_optimized_away_by_clang -
>funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-
>tautological-compare
>>> +DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) -
>Wno-empty-body -fno-stack-protector -mms-bitfields -Wno-address -Wno-
>shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -
>Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-
>redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-
>float -mno-implicit-float  -ftrap-
>function=undefined_behavior_has_been_optimized_away_by_clang -
>funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-
>tautological-compare
>>>
>>>  ###########################
>>>  # CLANG38 IA32 definitions
>>>
>>
>> _______________________________________________
>> 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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel