diff mbox series

[edk2] BaseTools/tools_def: add CLANG38 LTO versions for AARCH64 and ARM

Message ID 20171206113917.6166-1-ard.biesheuvel@linaro.org
State Superseded
Headers show
Series [edk2] BaseTools/tools_def: add CLANG38 LTO versions for AARCH64 and ARM | expand

Commit Message

Ard Biesheuvel Dec. 6, 2017, 11:39 a.m. UTC
Extend the CLANG38 toolchain definition so it can be used for
ARM and AARCH64 as well. Note that this requires llvm-ar and
the LLVMgold.so linker plugin.

In preparation of doing the same for GCC5, this toolchain version
also departs from the custom of using -O0 for DEBUG builds, which
makes them needlessly slow. Instead, let's add a NOOPT flavor as
well, and enable optimization for DEBUG like the other architectures
do. (Note that this will require some trivial changes to the platform
description files)

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 BaseTools/Conf/tools_def.template | 98 +++++++++++++++++++-
 1 file changed, 95 insertions(+), 3 deletions(-)

-- 
2.11.0

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

Comments

Laszlo Ersek Dec. 6, 2017, 2:12 p.m. UTC | #1
On 12/06/17 12:39, Ard Biesheuvel wrote:
> Extend the CLANG38 toolchain definition so it can be used for

> ARM and AARCH64 as well. Note that this requires llvm-ar and

> the LLVMgold.so linker plugin.

> 

> In preparation of doing the same for GCC5, this toolchain version

> also departs from the custom of using -O0 for DEBUG builds, which

> makes them needlessly slow. Instead, let's add a NOOPT flavor as

> well, and enable optimization for DEBUG like the other architectures

> do. (Note that this will require some trivial changes to the platform

> description files)

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  BaseTools/Conf/tools_def.template | 98 +++++++++++++++++++-

>  1 file changed, 95 insertions(+), 3 deletions(-)

> 

> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template

> index 91b135c2e569..6ee720d7586e 100755

> --- a/BaseTools/Conf/tools_def.template

> +++ b/BaseTools/Conf/tools_def.template

> @@ -399,8 +399,8 @@ DEFINE DTC_BIN                 = ENV(DTC_PREFIX)dtc

>  #                               Intel(r) ACPI Compiler from

>  #                               https://acpica.org/downloads

>  #   CLANG38  -Linux-  Requires:

> -#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu

> -#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 targeting x86_64-linux-gnu

> +#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi

> +#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 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

> @@ -5652,6 +5652,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)

>  *_CLANG38_*_MAKE_PATH               = make

>  *_CLANG38_*_*_DLL                   = ENV(CLANG38_DLL)

>  *_CLANG38_*_ASL_PATH                = DEF(UNIX_IASL_BIN)

> +*_CLANG38_*_DTC_PATH                = DEF(DTC_BIN)

>  

>  *_CLANG38_*_APP_FLAGS               =

>  *_CLANG38_*_ASL_FLAGS               = DEF(IASL_FLAGS)

> @@ -5663,7 +5664,8 @@ 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 -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 -Wno-unknown-warning-option -Wno-varargs

> +DEFINE CLANG38_WARNING_OVERRIDES    = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body  -Wno-varargs

> +DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -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-unknown-warning-option


At a quite superficial look, the patch seems OK to me. I'm just curious
about one thing: what decides if a -Wno... option goes into
CLANG38_WARNING_OVERRIDES? You left some -Wno... options out of it (kept
them explicitly in the CLANG38_ALL_CC_FLAGS define).

... It seems like the CLANG38_ALL_CC_FLAGS is not used for the ARM /
AARCH64 toolchains. "ALL" becomes sort of a misnomer then. Is that OK?

Thanks
Laszlo

>  

>  ###########################

>  # CLANG38 IA32 definitions

> @@ -5739,6 +5741,96 @@ NOOPT_CLANG38_X64_CC_FLAGS         = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__

>  NOOPT_CLANG38_X64_DLINK_FLAGS      = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small

>  NOOPT_CLANG38_X64_DLINK2_FLAGS     = DEF(GCC5_X64_DLINK2_FLAGS) -O0

>  

> +##################

> +# CLANG38 ARM definitions

> +##################

> +DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabihf

> +DEFINE CLANG38_ARM_CC_FLAGS      = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-movt

> +DEFINE CLANG38_ARM_DLINK_FLAGS   = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)

> +

> +*_CLANG38_ARM_PP_FLAGS           = DEF(GCC_PP_FLAGS)

> +*_CLANG38_ARM_ASLCC_FLAGS        = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_ARM_APP_FLAGS          =

> +*_CLANG38_ARM_ASL_FLAGS          = DEF(IASL_FLAGS)

> +*_CLANG38_ARM_ASL_OUTFLAGS       = DEF(IASL_OUTFLAGS)

> +*_CLANG38_ARM_DTCPP_FLAGS        = DEF(GCC_DTCPP_FLAGS)

> +

> +*_CLANG38_ARM_CC_PATH            = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASM_PATH           = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_PP_PATH            = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_VFRPP_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASLCC_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASLPP_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_DLINK_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASLDLINK_PATH      = ENV(CLANG38_BIN)clang

> +

> +*_CLANG38_ARM_SLINK_PATH         = ENV(CLANG38_BIN)llvm-ar

> +*_CLANG38_ARM_RC_PATH            = ENV(CLANG38_ARM_PREFIX)objcopy

> +

> +*_CLANG38_ARM_ASLCC_FLAGS        = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_ARM_ASLDLINK_FLAGS     = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_ASLDLINK_FLAGS)

> +*_CLANG38_ARM_ASM_FLAGS          = DEF(GCC_ASM_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments

> +*_CLANG38_ARM_DLINK2_FLAGS       = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220

> +*_CLANG38_ARM_PLATFORM_FLAGS     = -march=armv7-a

> +*_CLANG38_ARM_PP_FLAGS           = DEF(GCC_PP_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_ARM_RC_FLAGS           = DEF(GCC_ARM_RC_FLAGS)

> +*_CLANG38_ARM_VFRPP_FLAGS        = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_ARM_ASLPP_FLAGS        = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_ARM_TARGET)

> +*_CLANG38_ARM_CC_XIPFLAGS        = DEF(GCC_ARM_CC_XIPFLAGS)

> +

> +  DEBUG_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

> +  DEBUG_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3

> +  NOOPT_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0

> +  NOOPT_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS)

> +RELEASE_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

> +RELEASE_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3

> +

> +##################

> +# CLANG38 AARCH64 definitions

> +##################

> +DEFINE CLANG38_AARCH64_TARGET    = -target aarch64-linux-gnu

> +DEFINE CLANG38_AARCH64_CC_FLAGS  = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG38_AARCH64_TARGET) -mcmodel=small DEF(CLANG38_WARNING_OVERRIDES)

> +DEFINE CLANG38_AARCH64_DLINK_FLAGS  = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

> +

> +*_CLANG38_AARCH64_PP_FLAGS       = DEF(GCC_PP_FLAGS)

> +*_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_AARCH64_APP_FLAGS      =

> +*_CLANG38_AARCH64_ASL_FLAGS      = DEF(IASL_FLAGS)

> +*_CLANG38_AARCH64_ASL_OUTFLAGS   = DEF(IASL_OUTFLAGS)

> +*_CLANG38_AARCH64_DTCPP_FLAGS    = DEF(GCC_DTCPP_FLAGS)

> +

> +*_CLANG38_AARCH64_CC_PATH        = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASM_PATH       = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_PP_PATH        = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_VFRPP_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASLCC_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASLPP_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_DLINK_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASLDLINK_PATH  = ENV(CLANG38_BIN)clang

> +

> +*_CLANG38_AARCH64_SLINK_PATH     = ENV(CLANG38_BIN)llvm-ar

> +*_CLANG38_AARCH64_RC_PATH        = ENV(CLANG38_AARCH64_PREFIX)objcopy

> +

> +*_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_AARCH64_ASLDLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS)

> +*_CLANG38_AARCH64_ASM_FLAGS      = DEF(GCC_ASM_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments

> +*_CLANG38_AARCH64_DLINK_FLAGS    = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

> +*_CLANG38_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20

> +*_CLANG38_AARCH64_DLINK2_FLAGS   = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228

> +*_CLANG38_AARCH64_PLATFORM_FLAGS =

> +*_CLANG38_AARCH64_PP_FLAGS       = DEF(GCC_PP_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_AARCH64_RC_FLAGS       = DEF(GCC_AARCH64_RC_FLAGS)

> +*_CLANG38_AARCH64_VFRPP_FLAGS    = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_AARCH64_ASLPP_FLAGS    = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_AARCH64_TARGET)

> +*_CLANG38_AARCH64_CC_XIPFLAGS    = DEF(GCC_AARCH64_CC_XIPFLAGS)

> +

> +  DEBUG_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

> +  DEBUG_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3

> +  NOOPT_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0

> +  NOOPT_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS)

> +RELEASE_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

> +RELEASE_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3

> +

>  ####################################################################################

>  #

>  # Cygwin GCC And Intel ACPI Compiler

> 


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Dec. 6, 2017, 2:16 p.m. UTC | #2
On 6 December 2017 at 14:12, Laszlo Ersek <lersek@redhat.com> wrote:
> On 12/06/17 12:39, Ard Biesheuvel wrote:

>> Extend the CLANG38 toolchain definition so it can be used for

>> ARM and AARCH64 as well. Note that this requires llvm-ar and

>> the LLVMgold.so linker plugin.

>>

>> In preparation of doing the same for GCC5, this toolchain version

>> also departs from the custom of using -O0 for DEBUG builds, which

>> makes them needlessly slow. Instead, let's add a NOOPT flavor as

>> well, and enable optimization for DEBUG like the other architectures

>> do. (Note that this will require some trivial changes to the platform

>> description files)

>>

>> Contributed-under: TianoCore Contribution Agreement 1.1

>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> ---

>>  BaseTools/Conf/tools_def.template | 98 +++++++++++++++++++-

>>  1 file changed, 95 insertions(+), 3 deletions(-)

>>

>> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template

>> index 91b135c2e569..6ee720d7586e 100755

>> --- a/BaseTools/Conf/tools_def.template

>> +++ b/BaseTools/Conf/tools_def.template

>> @@ -399,8 +399,8 @@ DEFINE DTC_BIN                 = ENV(DTC_PREFIX)dtc

>>  #                               Intel(r) ACPI Compiler from

>>  #                               https://acpica.org/downloads

>>  #   CLANG38  -Linux-  Requires:

>> -#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu

>> -#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 targeting x86_64-linux-gnu

>> +#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi

>> +#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 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

>> @@ -5652,6 +5652,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)

>>  *_CLANG38_*_MAKE_PATH               = make

>>  *_CLANG38_*_*_DLL                   = ENV(CLANG38_DLL)

>>  *_CLANG38_*_ASL_PATH                = DEF(UNIX_IASL_BIN)

>> +*_CLANG38_*_DTC_PATH                = DEF(DTC_BIN)

>>

>>  *_CLANG38_*_APP_FLAGS               =

>>  *_CLANG38_*_ASL_FLAGS               = DEF(IASL_FLAGS)

>> @@ -5663,7 +5664,8 @@ 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 -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 -Wno-unknown-warning-option -Wno-varargs

>> +DEFINE CLANG38_WARNING_OVERRIDES    = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body  -Wno-varargs

>> +DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -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-unknown-warning-option

>

> At a quite superficial look, the patch seems OK to me. I'm just curious

> about one thing: what decides if a -Wno... option goes into

> CLANG38_WARNING_OVERRIDES? You left some -Wno... options out of it (kept

> them explicitly in the CLANG38_ALL_CC_FLAGS define).

>


I split off some warning overrides that are shared between all
architectures, and left the x86 only ones in CLANG38_ALL_CC_FLAGS

> ... It seems like the CLANG38_ALL_CC_FLAGS is not used for the ARM /

> AARCH64 toolchains. "ALL" becomes sort of a misnomer then. Is that OK?

>


Yes. In tools_def land, ALL still means 'both IA32 and X64', and I
have wasted too many cycles on trying to refactor the GCC toolchains
to care about it.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Laszlo Ersek Dec. 6, 2017, 2:28 p.m. UTC | #3
On 12/06/17 15:16, Ard Biesheuvel wrote:
> On 6 December 2017 at 14:12, Laszlo Ersek <lersek@redhat.com> wrote:

>> On 12/06/17 12:39, Ard Biesheuvel wrote:

>>> Extend the CLANG38 toolchain definition so it can be used for

>>> ARM and AARCH64 as well. Note that this requires llvm-ar and

>>> the LLVMgold.so linker plugin.

>>>

>>> In preparation of doing the same for GCC5, this toolchain version

>>> also departs from the custom of using -O0 for DEBUG builds, which

>>> makes them needlessly slow. Instead, let's add a NOOPT flavor as

>>> well, and enable optimization for DEBUG like the other architectures

>>> do. (Note that this will require some trivial changes to the platform

>>> description files)

>>>

>>> Contributed-under: TianoCore Contribution Agreement 1.1

>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>>> ---

>>>  BaseTools/Conf/tools_def.template | 98 +++++++++++++++++++-

>>>  1 file changed, 95 insertions(+), 3 deletions(-)

>>>

>>> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template

>>> index 91b135c2e569..6ee720d7586e 100755

>>> --- a/BaseTools/Conf/tools_def.template

>>> +++ b/BaseTools/Conf/tools_def.template

>>> @@ -399,8 +399,8 @@ DEFINE DTC_BIN                 = ENV(DTC_PREFIX)dtc

>>>  #                               Intel(r) ACPI Compiler from

>>>  #                               https://acpica.org/downloads

>>>  #   CLANG38  -Linux-  Requires:

>>> -#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu

>>> -#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 targeting x86_64-linux-gnu

>>> +#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi

>>> +#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 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

>>> @@ -5652,6 +5652,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)

>>>  *_CLANG38_*_MAKE_PATH               = make

>>>  *_CLANG38_*_*_DLL                   = ENV(CLANG38_DLL)

>>>  *_CLANG38_*_ASL_PATH                = DEF(UNIX_IASL_BIN)

>>> +*_CLANG38_*_DTC_PATH                = DEF(DTC_BIN)

>>>

>>>  *_CLANG38_*_APP_FLAGS               =

>>>  *_CLANG38_*_ASL_FLAGS               = DEF(IASL_FLAGS)

>>> @@ -5663,7 +5664,8 @@ 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 -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 -Wno-unknown-warning-option -Wno-varargs

>>> +DEFINE CLANG38_WARNING_OVERRIDES    = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body  -Wno-varargs

>>> +DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -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-unknown-warning-option

>>

>> At a quite superficial look, the patch seems OK to me. I'm just curious

>> about one thing: what decides if a -Wno... option goes into

>> CLANG38_WARNING_OVERRIDES? You left some -Wno... options out of it (kept

>> them explicitly in the CLANG38_ALL_CC_FLAGS define).

>>

> 

> I split off some warning overrides that are shared between all

> architectures, and left the x86 only ones in CLANG38_ALL_CC_FLAGS


That's what I suspected; it just seemed strange that we wanted to
suppress e.g. "-Waddress" for x86 only.

... I do see the point though -- suppressing warnings is always a messy
business, so whenever we can opt for *enabling* warnings, we should. Not
inheriting a -Wno... flag does just that.


>> ... It seems like the CLANG38_ALL_CC_FLAGS is not used for the ARM /

>> AARCH64 toolchains. "ALL" becomes sort of a misnomer then. Is that OK?

>>

> 

> Yes. In tools_def land, ALL still means 'both IA32 and X64', and I

> have wasted too many cycles on trying to refactor the GCC toolchains

> to care about it.


Fair enough.

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


Thanks!
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Dec. 6, 2017, 2:32 p.m. UTC | #4
On 6 December 2017 at 14:28, Laszlo Ersek <lersek@redhat.com> wrote:
> On 12/06/17 15:16, Ard Biesheuvel wrote:

>> On 6 December 2017 at 14:12, Laszlo Ersek <lersek@redhat.com> wrote:

>>> On 12/06/17 12:39, Ard Biesheuvel wrote:

>>>> Extend the CLANG38 toolchain definition so it can be used for

>>>> ARM and AARCH64 as well. Note that this requires llvm-ar and

>>>> the LLVMgold.so linker plugin.

>>>>

>>>> In preparation of doing the same for GCC5, this toolchain version

>>>> also departs from the custom of using -O0 for DEBUG builds, which

>>>> makes them needlessly slow. Instead, let's add a NOOPT flavor as

>>>> well, and enable optimization for DEBUG like the other architectures

>>>> do. (Note that this will require some trivial changes to the platform

>>>> description files)

>>>>

>>>> Contributed-under: TianoCore Contribution Agreement 1.1

>>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>>>> ---

>>>>  BaseTools/Conf/tools_def.template | 98 +++++++++++++++++++-

>>>>  1 file changed, 95 insertions(+), 3 deletions(-)

>>>>

>>>> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template

>>>> index 91b135c2e569..6ee720d7586e 100755

>>>> --- a/BaseTools/Conf/tools_def.template

>>>> +++ b/BaseTools/Conf/tools_def.template

>>>> @@ -399,8 +399,8 @@ DEFINE DTC_BIN                 = ENV(DTC_PREFIX)dtc

>>>>  #                               Intel(r) ACPI Compiler from

>>>>  #                               https://acpica.org/downloads

>>>>  #   CLANG38  -Linux-  Requires:

>>>> -#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu

>>>> -#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 targeting x86_64-linux-gnu

>>>> +#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi

>>>> +#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 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

>>>> @@ -5652,6 +5652,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)

>>>>  *_CLANG38_*_MAKE_PATH               = make

>>>>  *_CLANG38_*_*_DLL                   = ENV(CLANG38_DLL)

>>>>  *_CLANG38_*_ASL_PATH                = DEF(UNIX_IASL_BIN)

>>>> +*_CLANG38_*_DTC_PATH                = DEF(DTC_BIN)

>>>>

>>>>  *_CLANG38_*_APP_FLAGS               =

>>>>  *_CLANG38_*_ASL_FLAGS               = DEF(IASL_FLAGS)

>>>> @@ -5663,7 +5664,8 @@ 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 -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 -Wno-unknown-warning-option -Wno-varargs

>>>> +DEFINE CLANG38_WARNING_OVERRIDES    = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body  -Wno-varargs

>>>> +DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -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-unknown-warning-option

>>>

>>> At a quite superficial look, the patch seems OK to me. I'm just curious

>>> about one thing: what decides if a -Wno... option goes into

>>> CLANG38_WARNING_OVERRIDES? You left some -Wno... options out of it (kept

>>> them explicitly in the CLANG38_ALL_CC_FLAGS define).

>>>

>>

>> I split off some warning overrides that are shared between all

>> architectures, and left the x86 only ones in CLANG38_ALL_CC_FLAGS

>

> That's what I suspected; it just seemed strange that we wanted to

> suppress e.g. "-Waddress" for x86 only.

>

> ... I do see the point though -- suppressing warnings is always a messy

> business, so whenever we can opt for *enabling* warnings, we should. Not

> inheriting a -Wno... flag does just that.

>


Yes. I reluctantly added the -Wno-varargs option, for instance,
because we didn't need that for Clang 3.5, but more recent Clang
chokes on some questionable uses in EDK2, e.g.,

/home/ard/build/edk2/MdePkg/Library/UefiLib/UefiLib.c:1530:19: error:
passing an object that undergoes default argument promotion to
'va_start' has undefined behavior [-Werror,-Wvarargs]
  VA_START (Args, Iso639Language);
                  ^
/home/ard/build/edk2/MdePkg/Library/UefiLib/UefiLib.c:1517:19: note:
parameter of type 'BOOLEAN' (aka 'unsigned char') is declared here
  IN BOOLEAN      Iso639Language,
                  ^
1 error generated.

So indeed, I tried to be conservative in disabling warnings.

>

>>> ... It seems like the CLANG38_ALL_CC_FLAGS is not used for the ARM /

>>> AARCH64 toolchains. "ALL" becomes sort of a misnomer then. Is that OK?

>>>

>>

>> Yes. In tools_def land, ALL still means 'both IA32 and X64', and I

>> have wasted too many cycles on trying to refactor the GCC toolchains

>> to care about it.

>

> Fair enough.

>

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

>


Thanks.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Leif Lindholm Dec. 6, 2017, 5:17 p.m. UTC | #5
On Wed, Dec 06, 2017 at 11:39:17AM +0000, Ard Biesheuvel wrote:
> Extend the CLANG38 toolchain definition so it can be used for

> ARM and AARCH64 as well. Note that this requires llvm-ar and

> the LLVMgold.so linker plugin.

> 

> In preparation of doing the same for GCC5, this toolchain version

> also departs from the custom of using -O0 for DEBUG builds, which

> makes them needlessly slow. Instead, let's add a NOOPT flavor as

> well, and enable optimization for DEBUG like the other architectures

> do. (Note that this will require some trivial changes to the platform

> description files)

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


With the Arm/AArch64 ProcessorBind.h changes I just submitted:
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


> ---

>  BaseTools/Conf/tools_def.template | 98 +++++++++++++++++++-

>  1 file changed, 95 insertions(+), 3 deletions(-)

> 

> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template

> index 91b135c2e569..6ee720d7586e 100755

> --- a/BaseTools/Conf/tools_def.template

> +++ b/BaseTools/Conf/tools_def.template

> @@ -399,8 +399,8 @@ DEFINE DTC_BIN                 = ENV(DTC_PREFIX)dtc

>  #                               Intel(r) ACPI Compiler from

>  #                               https://acpica.org/downloads

>  #   CLANG38  -Linux-  Requires:

> -#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu

> -#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 targeting x86_64-linux-gnu

> +#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi

> +#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 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

> @@ -5652,6 +5652,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)

>  *_CLANG38_*_MAKE_PATH               = make

>  *_CLANG38_*_*_DLL                   = ENV(CLANG38_DLL)

>  *_CLANG38_*_ASL_PATH                = DEF(UNIX_IASL_BIN)

> +*_CLANG38_*_DTC_PATH                = DEF(DTC_BIN)

>  

>  *_CLANG38_*_APP_FLAGS               =

>  *_CLANG38_*_ASL_FLAGS               = DEF(IASL_FLAGS)

> @@ -5663,7 +5664,8 @@ 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 -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 -Wno-unknown-warning-option -Wno-varargs

> +DEFINE CLANG38_WARNING_OVERRIDES    = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body  -Wno-varargs

> +DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -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-unknown-warning-option

>  

>  ###########################

>  # CLANG38 IA32 definitions

> @@ -5739,6 +5741,96 @@ NOOPT_CLANG38_X64_CC_FLAGS         = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__

>  NOOPT_CLANG38_X64_DLINK_FLAGS      = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small

>  NOOPT_CLANG38_X64_DLINK2_FLAGS     = DEF(GCC5_X64_DLINK2_FLAGS) -O0

>  

> +##################

> +# CLANG38 ARM definitions

> +##################

> +DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabihf

> +DEFINE CLANG38_ARM_CC_FLAGS      = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-movt

> +DEFINE CLANG38_ARM_DLINK_FLAGS   = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)

> +

> +*_CLANG38_ARM_PP_FLAGS           = DEF(GCC_PP_FLAGS)

> +*_CLANG38_ARM_ASLCC_FLAGS        = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_ARM_APP_FLAGS          =

> +*_CLANG38_ARM_ASL_FLAGS          = DEF(IASL_FLAGS)

> +*_CLANG38_ARM_ASL_OUTFLAGS       = DEF(IASL_OUTFLAGS)

> +*_CLANG38_ARM_DTCPP_FLAGS        = DEF(GCC_DTCPP_FLAGS)

> +

> +*_CLANG38_ARM_CC_PATH            = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASM_PATH           = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_PP_PATH            = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_VFRPP_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASLCC_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASLPP_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_DLINK_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASLDLINK_PATH      = ENV(CLANG38_BIN)clang

> +

> +*_CLANG38_ARM_SLINK_PATH         = ENV(CLANG38_BIN)llvm-ar

> +*_CLANG38_ARM_RC_PATH            = ENV(CLANG38_ARM_PREFIX)objcopy

> +

> +*_CLANG38_ARM_ASLCC_FLAGS        = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_ARM_ASLDLINK_FLAGS     = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_ASLDLINK_FLAGS)

> +*_CLANG38_ARM_ASM_FLAGS          = DEF(GCC_ASM_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments

> +*_CLANG38_ARM_DLINK2_FLAGS       = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220

> +*_CLANG38_ARM_PLATFORM_FLAGS     = -march=armv7-a

> +*_CLANG38_ARM_PP_FLAGS           = DEF(GCC_PP_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_ARM_RC_FLAGS           = DEF(GCC_ARM_RC_FLAGS)

> +*_CLANG38_ARM_VFRPP_FLAGS        = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_ARM_ASLPP_FLAGS        = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_ARM_TARGET)

> +*_CLANG38_ARM_CC_XIPFLAGS        = DEF(GCC_ARM_CC_XIPFLAGS)

> +

> +  DEBUG_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

> +  DEBUG_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3

> +  NOOPT_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0

> +  NOOPT_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS)

> +RELEASE_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

> +RELEASE_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3

> +

> +##################

> +# CLANG38 AARCH64 definitions

> +##################

> +DEFINE CLANG38_AARCH64_TARGET    = -target aarch64-linux-gnu

> +DEFINE CLANG38_AARCH64_CC_FLAGS  = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG38_AARCH64_TARGET) -mcmodel=small DEF(CLANG38_WARNING_OVERRIDES)

> +DEFINE CLANG38_AARCH64_DLINK_FLAGS  = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

> +

> +*_CLANG38_AARCH64_PP_FLAGS       = DEF(GCC_PP_FLAGS)

> +*_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_AARCH64_APP_FLAGS      =

> +*_CLANG38_AARCH64_ASL_FLAGS      = DEF(IASL_FLAGS)

> +*_CLANG38_AARCH64_ASL_OUTFLAGS   = DEF(IASL_OUTFLAGS)

> +*_CLANG38_AARCH64_DTCPP_FLAGS    = DEF(GCC_DTCPP_FLAGS)

> +

> +*_CLANG38_AARCH64_CC_PATH        = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASM_PATH       = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_PP_PATH        = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_VFRPP_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASLCC_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASLPP_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_DLINK_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASLDLINK_PATH  = ENV(CLANG38_BIN)clang

> +

> +*_CLANG38_AARCH64_SLINK_PATH     = ENV(CLANG38_BIN)llvm-ar

> +*_CLANG38_AARCH64_RC_PATH        = ENV(CLANG38_AARCH64_PREFIX)objcopy

> +

> +*_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_AARCH64_ASLDLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS)

> +*_CLANG38_AARCH64_ASM_FLAGS      = DEF(GCC_ASM_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments

> +*_CLANG38_AARCH64_DLINK_FLAGS    = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

> +*_CLANG38_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20

> +*_CLANG38_AARCH64_DLINK2_FLAGS   = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228

> +*_CLANG38_AARCH64_PLATFORM_FLAGS =

> +*_CLANG38_AARCH64_PP_FLAGS       = DEF(GCC_PP_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_AARCH64_RC_FLAGS       = DEF(GCC_AARCH64_RC_FLAGS)

> +*_CLANG38_AARCH64_VFRPP_FLAGS    = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_AARCH64_ASLPP_FLAGS    = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_AARCH64_TARGET)

> +*_CLANG38_AARCH64_CC_XIPFLAGS    = DEF(GCC_AARCH64_CC_XIPFLAGS)

> +

> +  DEBUG_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

> +  DEBUG_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3

> +  NOOPT_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0

> +  NOOPT_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS)

> +RELEASE_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

> +RELEASE_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3

> +

>  ####################################################################################

>  #

>  # Cygwin GCC And Intel ACPI Compiler

> -- 

> 2.11.0

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Shi, Steven Dec. 7, 2017, 2:05 a.m. UTC | #6
Hi Ard,
I'm OK for the patch.
BTW, would you mind to help add the "-Wno-unused-const-variable" in the CLANG38_WARNING_OVERRIDES? I happen to need add it in CLANG38 (https://bugzilla.tianocore.org/show_bug.cgi?id=790) and I see it seems a shared flag for ARM/AARCH64 as well.

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: Wednesday, December 6, 2017 7:39 PM

> To: edk2-devel@lists.01.org

> Cc: leif.lindholm@linaro.org; Gao, Liming <liming.gao@intel.com>; Zhu,

> Yonghong <yonghong.zhu@intel.com>; Shi, Steven <steven.shi@intel.com>;

> evan.lloyd@arm.com; lersek@redhat.com; Ard Biesheuvel

> <ard.biesheuvel@linaro.org>

> Subject: [PATCH] BaseTools/tools_def: add CLANG38 LTO versions for

> AARCH64 and ARM

> 

> Extend the CLANG38 toolchain definition so it can be used for

> ARM and AARCH64 as well. Note that this requires llvm-ar and

> the LLVMgold.so linker plugin.

> 

> In preparation of doing the same for GCC5, this toolchain version

> also departs from the custom of using -O0 for DEBUG builds, which

> makes them needlessly slow. Instead, let's add a NOOPT flavor as

> well, and enable optimization for DEBUG like the other architectures

> do. (Note that this will require some trivial changes to the platform

> description files)

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  BaseTools/Conf/tools_def.template | 98 +++++++++++++++++++-

>  1 file changed, 95 insertions(+), 3 deletions(-)

> 

> diff --git a/BaseTools/Conf/tools_def.template

> b/BaseTools/Conf/tools_def.template

> index 91b135c2e569..6ee720d7586e 100755

> --- a/BaseTools/Conf/tools_def.template

> +++ b/BaseTools/Conf/tools_def.template

> @@ -399,8 +399,8 @@ DEFINE DTC_BIN                 = ENV(DTC_PREFIX)dtc

>  #                               Intel(r) ACPI Compiler from

>  #                               https://acpica.org/downloads

>  #   CLANG38  -Linux-  Requires:

> -#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26

> targeting x86_64-linux-gnu

> -#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28

> targeting x86_64-linux-gnu

> +#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26

> targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi

> +#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28

> 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

> @@ -5652,6 +5652,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS =

> DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)

>  *_CLANG38_*_MAKE_PATH               = make

>  *_CLANG38_*_*_DLL                   = ENV(CLANG38_DLL)

>  *_CLANG38_*_ASL_PATH                = DEF(UNIX_IASL_BIN)

> +*_CLANG38_*_DTC_PATH                = DEF(DTC_BIN)

> 

>  *_CLANG38_*_APP_FLAGS               =

>  *_CLANG38_*_ASL_FLAGS               = DEF(IASL_FLAGS)

> @@ -5663,7 +5664,8 @@ 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 -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 -Wno-unknown-warning-option -Wno-varargs

> +DEFINE CLANG38_WARNING_OVERRIDES    = -Wno-parentheses-equality -

> Wno-tautological-compare -Wno-tautological-constant-out-of-range-

> compare -Wno-empty-body  -Wno-varargs

> +DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS)

> DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -

> Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -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-unknown-

> warning-option

> 

>  ###########################

>  # CLANG38 IA32 definitions

> @@ -5739,6 +5741,96 @@ NOOPT_CLANG38_X64_CC_FLAGS         =

> DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__

>  NOOPT_CLANG38_X64_DLINK_FLAGS      =

> DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--

> oformat=elf64-x86-64 -Wl,-pie -mcmodel=small

>  NOOPT_CLANG38_X64_DLINK2_FLAGS     = DEF(GCC5_X64_DLINK2_FLAGS) -

> O0

> 

> +##################

> +# CLANG38 ARM definitions

> +##################

> +DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabihf

> +DEFINE CLANG38_ARM_CC_FLAGS      = DEF(GCC_ARM_CC_FLAGS)

> DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-

> movt

> +DEFINE CLANG38_ARM_DLINK_FLAGS   = DEF(CLANG38_ARM_TARGET)

> DEF(GCC_ARM_DLINK_FLAGS)

> +

> +*_CLANG38_ARM_PP_FLAGS           = DEF(GCC_PP_FLAGS)

> +*_CLANG38_ARM_ASLCC_FLAGS        = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_ARM_APP_FLAGS          =

> +*_CLANG38_ARM_ASL_FLAGS          = DEF(IASL_FLAGS)

> +*_CLANG38_ARM_ASL_OUTFLAGS       = DEF(IASL_OUTFLAGS)

> +*_CLANG38_ARM_DTCPP_FLAGS        = DEF(GCC_DTCPP_FLAGS)

> +

> +*_CLANG38_ARM_CC_PATH            = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASM_PATH           = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_PP_PATH            = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_VFRPP_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASLCC_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASLPP_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_DLINK_PATH         = ENV(CLANG38_BIN)clang

> +*_CLANG38_ARM_ASLDLINK_PATH      = ENV(CLANG38_BIN)clang

> +

> +*_CLANG38_ARM_SLINK_PATH         = ENV(CLANG38_BIN)llvm-ar

> +*_CLANG38_ARM_RC_PATH            = ENV(CLANG38_ARM_PREFIX)objcopy

> +

> +*_CLANG38_ARM_ASLCC_FLAGS        = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_ARM_ASLDLINK_FLAGS     = DEF(CLANG38_ARM_TARGET)

> DEF(GCC_ARM_ASLDLINK_FLAGS)

> +*_CLANG38_ARM_ASM_FLAGS          = DEF(GCC_ASM_FLAGS)

> DEF(CLANG38_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -

> Qunused-arguments

> +*_CLANG38_ARM_DLINK2_FLAGS       =

> DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--

> defsym=PECOFF_HEADER_SIZE=0x220

> +*_CLANG38_ARM_PLATFORM_FLAGS     = -march=armv7-a

> +*_CLANG38_ARM_PP_FLAGS           = DEF(GCC_PP_FLAGS)

> DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_ARM_RC_FLAGS           = DEF(GCC_ARM_RC_FLAGS)

> +*_CLANG38_ARM_VFRPP_FLAGS        = DEF(GCC_VFRPP_FLAGS)

> DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_ARM_ASLPP_FLAGS        = DEF(GCC_ASLPP_FLAGS)

> DEF(CLANG38_ARM_TARGET)

> +*_CLANG38_ARM_CC_XIPFLAGS        = DEF(GCC_ARM_CC_XIPFLAGS)

> +

> +  DEBUG_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS)

> $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

> +  DEBUG_CLANG38_ARM_DLINK_FLAGS  =

> DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3

> +  NOOPT_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS)

> $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0

> +  NOOPT_CLANG38_ARM_DLINK_FLAGS  =

> DEF(CLANG38_ARM_DLINK_FLAGS)

> +RELEASE_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS)

> $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

> +RELEASE_CLANG38_ARM_DLINK_FLAGS  =

> DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3

> +

> +##################

> +# CLANG38 AARCH64 definitions

> +##################

> +DEFINE CLANG38_AARCH64_TARGET    = -target aarch64-linux-gnu

> +DEFINE CLANG38_AARCH64_CC_FLAGS  = DEF(GCC_AARCH64_CC_FLAGS)

> DEF(CLANG38_AARCH64_TARGET) -mcmodel=small

> DEF(CLANG38_WARNING_OVERRIDES)

> +DEFINE CLANG38_AARCH64_DLINK_FLAGS  =

> DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z

> common-page-size=0x1000

> +

> +*_CLANG38_AARCH64_PP_FLAGS       = DEF(GCC_PP_FLAGS)

> +*_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_AARCH64_APP_FLAGS      =

> +*_CLANG38_AARCH64_ASL_FLAGS      = DEF(IASL_FLAGS)

> +*_CLANG38_AARCH64_ASL_OUTFLAGS   = DEF(IASL_OUTFLAGS)

> +*_CLANG38_AARCH64_DTCPP_FLAGS    = DEF(GCC_DTCPP_FLAGS)

> +

> +*_CLANG38_AARCH64_CC_PATH        = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASM_PATH       = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_PP_PATH        = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_VFRPP_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASLCC_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASLPP_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_DLINK_PATH     = ENV(CLANG38_BIN)clang

> +*_CLANG38_AARCH64_ASLDLINK_PATH  = ENV(CLANG38_BIN)clang

> +

> +*_CLANG38_AARCH64_SLINK_PATH     = ENV(CLANG38_BIN)llvm-ar

> +*_CLANG38_AARCH64_RC_PATH        =

> ENV(CLANG38_AARCH64_PREFIX)objcopy

> +

> +*_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS)

> +*_CLANG38_AARCH64_ASLDLINK_FLAGS =

> DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS)

> +*_CLANG38_AARCH64_ASM_FLAGS      = DEF(GCC_ASM_FLAGS)

> DEF(CLANG38_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS)

> -Qunused-arguments

> +*_CLANG38_AARCH64_DLINK_FLAGS    = DEF(CLANG38_AARCH64_TARGET)

> DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

> +*_CLANG38_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20

> +*_CLANG38_AARCH64_DLINK2_FLAGS   =

> DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--

> defsym=PECOFF_HEADER_SIZE=0x228

> +*_CLANG38_AARCH64_PLATFORM_FLAGS =

> +*_CLANG38_AARCH64_PP_FLAGS       = DEF(GCC_PP_FLAGS)

> DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_AARCH64_RC_FLAGS       = DEF(GCC_AARCH64_RC_FLAGS)

> +*_CLANG38_AARCH64_VFRPP_FLAGS    = DEF(GCC_VFRPP_FLAGS)

> DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> +*_CLANG38_AARCH64_ASLPP_FLAGS    = DEF(GCC_ASLPP_FLAGS)

> DEF(CLANG38_AARCH64_TARGET)

> +*_CLANG38_AARCH64_CC_XIPFLAGS    = DEF(GCC_AARCH64_CC_XIPFLAGS)

> +

> +  DEBUG_CLANG38_AARCH64_CC_FLAGS    =

> DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> -O3

> +  DEBUG_CLANG38_AARCH64_DLINK_FLAGS =

> DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3

> +  NOOPT_CLANG38_AARCH64_CC_FLAGS    =

> DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> -O0

> +  NOOPT_CLANG38_AARCH64_DLINK_FLAGS =

> DEF(CLANG38_AARCH64_DLINK_FLAGS)

> +RELEASE_CLANG38_AARCH64_CC_FLAGS    =

> DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

> -O3

> +RELEASE_CLANG38_AARCH64_DLINK_FLAGS =

> DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3

> +

> 

> ##############################################################

> ######################

>  #

>  # Cygwin GCC And Intel ACPI Compiler

> --

> 2.11.0


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Laszlo Ersek Dec. 7, 2017, 11:09 a.m. UTC | #7
On 12/07/17 03:05, Shi, Steven wrote:
> Hi Ard,

> I'm OK for the patch.

> BTW, would you mind to help add the "-Wno-unused-const-variable" in the CLANG38_WARNING_OVERRIDES? I happen to need add it in CLANG38 (https://bugzilla.tianocore.org/show_bug.cgi?id=790) and I see it seems a shared flag for ARM/AARCH64 as well.


I suggest we handle that flag / BZ separately from this patch. (If Ard
feels very generous, he could append a separate patch to this series,
for adding the flag, but I don't think we can *ask* for that. It's a
totally separate topic.)

Thanks!
Laszlo

> 

> 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: Wednesday, December 6, 2017 7:39 PM

>> To: edk2-devel@lists.01.org

>> Cc: leif.lindholm@linaro.org; Gao, Liming <liming.gao@intel.com>; Zhu,

>> Yonghong <yonghong.zhu@intel.com>; Shi, Steven <steven.shi@intel.com>;

>> evan.lloyd@arm.com; lersek@redhat.com; Ard Biesheuvel

>> <ard.biesheuvel@linaro.org>

>> Subject: [PATCH] BaseTools/tools_def: add CLANG38 LTO versions for

>> AARCH64 and ARM

>>

>> Extend the CLANG38 toolchain definition so it can be used for

>> ARM and AARCH64 as well. Note that this requires llvm-ar and

>> the LLVMgold.so linker plugin.

>>

>> In preparation of doing the same for GCC5, this toolchain version

>> also departs from the custom of using -O0 for DEBUG builds, which

>> makes them needlessly slow. Instead, let's add a NOOPT flavor as

>> well, and enable optimization for DEBUG like the other architectures

>> do. (Note that this will require some trivial changes to the platform

>> description files)

>>

>> Contributed-under: TianoCore Contribution Agreement 1.1

>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> ---

>>  BaseTools/Conf/tools_def.template | 98 +++++++++++++++++++-

>>  1 file changed, 95 insertions(+), 3 deletions(-)

>>

>> diff --git a/BaseTools/Conf/tools_def.template

>> b/BaseTools/Conf/tools_def.template

>> index 91b135c2e569..6ee720d7586e 100755

>> --- a/BaseTools/Conf/tools_def.template

>> +++ b/BaseTools/Conf/tools_def.template

>> @@ -399,8 +399,8 @@ DEFINE DTC_BIN                 = ENV(DTC_PREFIX)dtc

>>  #                               Intel(r) ACPI Compiler from

>>  #                               https://acpica.org/downloads

>>  #   CLANG38  -Linux-  Requires:

>> -#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26

>> targeting x86_64-linux-gnu

>> -#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28

>> targeting x86_64-linux-gnu

>> +#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26

>> targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi

>> +#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28

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

>> @@ -5652,6 +5652,7 @@ RELEASE_CLANG35_AARCH64_CC_FLAGS =

>> DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)

>>  *_CLANG38_*_MAKE_PATH               = make

>>  *_CLANG38_*_*_DLL                   = ENV(CLANG38_DLL)

>>  *_CLANG38_*_ASL_PATH                = DEF(UNIX_IASL_BIN)

>> +*_CLANG38_*_DTC_PATH                = DEF(DTC_BIN)

>>

>>  *_CLANG38_*_APP_FLAGS               =

>>  *_CLANG38_*_ASL_FLAGS               = DEF(IASL_FLAGS)

>> @@ -5663,7 +5664,8 @@ 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 -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 -Wno-unknown-warning-option -Wno-varargs

>> +DEFINE CLANG38_WARNING_OVERRIDES    = -Wno-parentheses-equality -

>> Wno-tautological-compare -Wno-tautological-constant-out-of-range-

>> compare -Wno-empty-body  -Wno-varargs

>> +DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS)

>> DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -

>> Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -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-unknown-

>> warning-option

>>

>>  ###########################

>>  # CLANG38 IA32 definitions

>> @@ -5739,6 +5741,96 @@ NOOPT_CLANG38_X64_CC_FLAGS         =

>> DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__

>>  NOOPT_CLANG38_X64_DLINK_FLAGS      =

>> DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--

>> oformat=elf64-x86-64 -Wl,-pie -mcmodel=small

>>  NOOPT_CLANG38_X64_DLINK2_FLAGS     = DEF(GCC5_X64_DLINK2_FLAGS) -

>> O0

>>

>> +##################

>> +# CLANG38 ARM definitions

>> +##################

>> +DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabihf

>> +DEFINE CLANG38_ARM_CC_FLAGS      = DEF(GCC_ARM_CC_FLAGS)

>> DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-

>> movt

>> +DEFINE CLANG38_ARM_DLINK_FLAGS   = DEF(CLANG38_ARM_TARGET)

>> DEF(GCC_ARM_DLINK_FLAGS)

>> +

>> +*_CLANG38_ARM_PP_FLAGS           = DEF(GCC_PP_FLAGS)

>> +*_CLANG38_ARM_ASLCC_FLAGS        = DEF(GCC_ASLCC_FLAGS)

>> +*_CLANG38_ARM_APP_FLAGS          =

>> +*_CLANG38_ARM_ASL_FLAGS          = DEF(IASL_FLAGS)

>> +*_CLANG38_ARM_ASL_OUTFLAGS       = DEF(IASL_OUTFLAGS)

>> +*_CLANG38_ARM_DTCPP_FLAGS        = DEF(GCC_DTCPP_FLAGS)

>> +

>> +*_CLANG38_ARM_CC_PATH            = ENV(CLANG38_BIN)clang

>> +*_CLANG38_ARM_ASM_PATH           = ENV(CLANG38_BIN)clang

>> +*_CLANG38_ARM_PP_PATH            = ENV(CLANG38_BIN)clang

>> +*_CLANG38_ARM_VFRPP_PATH         = ENV(CLANG38_BIN)clang

>> +*_CLANG38_ARM_ASLCC_PATH         = ENV(CLANG38_BIN)clang

>> +*_CLANG38_ARM_ASLPP_PATH         = ENV(CLANG38_BIN)clang

>> +*_CLANG38_ARM_DLINK_PATH         = ENV(CLANG38_BIN)clang

>> +*_CLANG38_ARM_ASLDLINK_PATH      = ENV(CLANG38_BIN)clang

>> +

>> +*_CLANG38_ARM_SLINK_PATH         = ENV(CLANG38_BIN)llvm-ar

>> +*_CLANG38_ARM_RC_PATH            = ENV(CLANG38_ARM_PREFIX)objcopy

>> +

>> +*_CLANG38_ARM_ASLCC_FLAGS        = DEF(GCC_ASLCC_FLAGS)

>> +*_CLANG38_ARM_ASLDLINK_FLAGS     = DEF(CLANG38_ARM_TARGET)

>> DEF(GCC_ARM_ASLDLINK_FLAGS)

>> +*_CLANG38_ARM_ASM_FLAGS          = DEF(GCC_ASM_FLAGS)

>> DEF(CLANG38_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -

>> Qunused-arguments

>> +*_CLANG38_ARM_DLINK2_FLAGS       =

>> DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--

>> defsym=PECOFF_HEADER_SIZE=0x220

>> +*_CLANG38_ARM_PLATFORM_FLAGS     = -march=armv7-a

>> +*_CLANG38_ARM_PP_FLAGS           = DEF(GCC_PP_FLAGS)

>> DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

>> +*_CLANG38_ARM_RC_FLAGS           = DEF(GCC_ARM_RC_FLAGS)

>> +*_CLANG38_ARM_VFRPP_FLAGS        = DEF(GCC_VFRPP_FLAGS)

>> DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

>> +*_CLANG38_ARM_ASLPP_FLAGS        = DEF(GCC_ASLPP_FLAGS)

>> DEF(CLANG38_ARM_TARGET)

>> +*_CLANG38_ARM_CC_XIPFLAGS        = DEF(GCC_ARM_CC_XIPFLAGS)

>> +

>> +  DEBUG_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS)

>> $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

>> +  DEBUG_CLANG38_ARM_DLINK_FLAGS  =

>> DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3

>> +  NOOPT_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS)

>> $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0

>> +  NOOPT_CLANG38_ARM_DLINK_FLAGS  =

>> DEF(CLANG38_ARM_DLINK_FLAGS)

>> +RELEASE_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS)

>> $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3

>> +RELEASE_CLANG38_ARM_DLINK_FLAGS  =

>> DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3

>> +

>> +##################

>> +# CLANG38 AARCH64 definitions

>> +##################

>> +DEFINE CLANG38_AARCH64_TARGET    = -target aarch64-linux-gnu

>> +DEFINE CLANG38_AARCH64_CC_FLAGS  = DEF(GCC_AARCH64_CC_FLAGS)

>> DEF(CLANG38_AARCH64_TARGET) -mcmodel=small

>> DEF(CLANG38_WARNING_OVERRIDES)

>> +DEFINE CLANG38_AARCH64_DLINK_FLAGS  =

>> DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z

>> common-page-size=0x1000

>> +

>> +*_CLANG38_AARCH64_PP_FLAGS       = DEF(GCC_PP_FLAGS)

>> +*_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS)

>> +*_CLANG38_AARCH64_APP_FLAGS      =

>> +*_CLANG38_AARCH64_ASL_FLAGS      = DEF(IASL_FLAGS)

>> +*_CLANG38_AARCH64_ASL_OUTFLAGS   = DEF(IASL_OUTFLAGS)

>> +*_CLANG38_AARCH64_DTCPP_FLAGS    = DEF(GCC_DTCPP_FLAGS)

>> +

>> +*_CLANG38_AARCH64_CC_PATH        = ENV(CLANG38_BIN)clang

>> +*_CLANG38_AARCH64_ASM_PATH       = ENV(CLANG38_BIN)clang

>> +*_CLANG38_AARCH64_PP_PATH        = ENV(CLANG38_BIN)clang

>> +*_CLANG38_AARCH64_VFRPP_PATH     = ENV(CLANG38_BIN)clang

>> +*_CLANG38_AARCH64_ASLCC_PATH     = ENV(CLANG38_BIN)clang

>> +*_CLANG38_AARCH64_ASLPP_PATH     = ENV(CLANG38_BIN)clang

>> +*_CLANG38_AARCH64_DLINK_PATH     = ENV(CLANG38_BIN)clang

>> +*_CLANG38_AARCH64_ASLDLINK_PATH  = ENV(CLANG38_BIN)clang

>> +

>> +*_CLANG38_AARCH64_SLINK_PATH     = ENV(CLANG38_BIN)llvm-ar

>> +*_CLANG38_AARCH64_RC_PATH        =

>> ENV(CLANG38_AARCH64_PREFIX)objcopy

>> +

>> +*_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS)

>> +*_CLANG38_AARCH64_ASLDLINK_FLAGS =

>> DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS)

>> +*_CLANG38_AARCH64_ASM_FLAGS      = DEF(GCC_ASM_FLAGS)

>> DEF(CLANG38_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS)

>> -Qunused-arguments

>> +*_CLANG38_AARCH64_DLINK_FLAGS    = DEF(CLANG38_AARCH64_TARGET)

>> DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

>> +*_CLANG38_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20

>> +*_CLANG38_AARCH64_DLINK2_FLAGS   =

>> DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--

>> defsym=PECOFF_HEADER_SIZE=0x228

>> +*_CLANG38_AARCH64_PLATFORM_FLAGS =

>> +*_CLANG38_AARCH64_PP_FLAGS       = DEF(GCC_PP_FLAGS)

>> DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

>> +*_CLANG38_AARCH64_RC_FLAGS       = DEF(GCC_AARCH64_RC_FLAGS)

>> +*_CLANG38_AARCH64_VFRPP_FLAGS    = DEF(GCC_VFRPP_FLAGS)

>> DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

>> +*_CLANG38_AARCH64_ASLPP_FLAGS    = DEF(GCC_ASLPP_FLAGS)

>> DEF(CLANG38_AARCH64_TARGET)

>> +*_CLANG38_AARCH64_CC_XIPFLAGS    = DEF(GCC_AARCH64_CC_XIPFLAGS)

>> +

>> +  DEBUG_CLANG38_AARCH64_CC_FLAGS    =

>> DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

>> -O3

>> +  DEBUG_CLANG38_AARCH64_DLINK_FLAGS =

>> DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3

>> +  NOOPT_CLANG38_AARCH64_CC_FLAGS    =

>> DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

>> -O0

>> +  NOOPT_CLANG38_AARCH64_DLINK_FLAGS =

>> DEF(CLANG38_AARCH64_DLINK_FLAGS)

>> +RELEASE_CLANG38_AARCH64_CC_FLAGS    =

>> DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)

>> -O3

>> +RELEASE_CLANG38_AARCH64_DLINK_FLAGS =

>> DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3

>> +

>>

>> ##############################################################

>> ######################

>>  #

>>  # Cygwin GCC And Intel ACPI Compiler

>> --

>> 2.11.0

> 


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Dec. 7, 2017, 11:19 a.m. UTC | #8
On 7 December 2017 at 11:09, Laszlo Ersek <lersek@redhat.com> wrote:
> On 12/07/17 03:05, Shi, Steven wrote:

>> Hi Ard,

>> I'm OK for the patch.

>> BTW, would you mind to help add the "-Wno-unused-const-variable" in the CLANG38_WARNING_OVERRIDES? I happen to need add it in CLANG38 (https://bugzilla.tianocore.org/show_bug.cgi?id=790) and I see it seems a shared flag for ARM/AARCH64 as well.

>

> I suggest we handle that flag / BZ separately from this patch. (If Ard

> feels very generous, he could append a separate patch to this series,

> for adding the flag, but I don't think we can *ask* for that. It's a

> totally separate topic.)

>


Yes, it is. But guess what, I was feeling very generous, so I did exactly that.
(I am guessing Steven is very busy, so I don't mind doing his work :-))

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

Patch

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 91b135c2e569..6ee720d7586e 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -399,8 +399,8 @@  DEFINE DTC_BIN                 = ENV(DTC_PREFIX)dtc
 #                               Intel(r) ACPI Compiler from
 #                               https://acpica.org/downloads
 #   CLANG38  -Linux-  Requires:
-#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu
-#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 targeting x86_64-linux-gnu
+#                             Clang v3.8, LLVMgold plugin and GNU binutils 2.26 targeting x86_64-linux-gnu, aarch64-linux-gnu or arm-linux-gnueabi
+#                             Clang v3.9 or later, LLVMgold plugin and GNU binutils 2.28 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
@@ -5652,6 +5652,7 @@  RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS)
 *_CLANG38_*_MAKE_PATH               = make
 *_CLANG38_*_*_DLL                   = ENV(CLANG38_DLL)
 *_CLANG38_*_ASL_PATH                = DEF(UNIX_IASL_BIN)
+*_CLANG38_*_DTC_PATH                = DEF(DTC_BIN)
 
 *_CLANG38_*_APP_FLAGS               =
 *_CLANG38_*_ASL_FLAGS               = DEF(IASL_FLAGS)
@@ -5663,7 +5664,8 @@  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 -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 -Wno-unknown-warning-option -Wno-varargs
+DEFINE CLANG38_WARNING_OVERRIDES    = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body  -Wno-varargs
+DEFINE CLANG38_ALL_CC_FLAGS         = DEF(GCC44_ALL_CC_FLAGS) DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -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-unknown-warning-option
 
 ###########################
 # CLANG38 IA32 definitions
@@ -5739,6 +5741,96 @@  NOOPT_CLANG38_X64_CC_FLAGS         = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__
 NOOPT_CLANG38_X64_DLINK_FLAGS      = DEF(GCC5_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie -mcmodel=small
 NOOPT_CLANG38_X64_DLINK2_FLAGS     = DEF(GCC5_X64_DLINK2_FLAGS) -O0
 
+##################
+# CLANG38 ARM definitions
+##################
+DEFINE CLANG38_ARM_TARGET        = -target arm-linux-gnueabihf
+DEFINE CLANG38_ARM_CC_FLAGS      = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-movt
+DEFINE CLANG38_ARM_DLINK_FLAGS   = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)
+
+*_CLANG38_ARM_PP_FLAGS           = DEF(GCC_PP_FLAGS)
+*_CLANG38_ARM_ASLCC_FLAGS        = DEF(GCC_ASLCC_FLAGS)
+*_CLANG38_ARM_APP_FLAGS          =
+*_CLANG38_ARM_ASL_FLAGS          = DEF(IASL_FLAGS)
+*_CLANG38_ARM_ASL_OUTFLAGS       = DEF(IASL_OUTFLAGS)
+*_CLANG38_ARM_DTCPP_FLAGS        = DEF(GCC_DTCPP_FLAGS)
+
+*_CLANG38_ARM_CC_PATH            = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_ASM_PATH           = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_PP_PATH            = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_VFRPP_PATH         = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_ASLCC_PATH         = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_ASLPP_PATH         = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_DLINK_PATH         = ENV(CLANG38_BIN)clang
+*_CLANG38_ARM_ASLDLINK_PATH      = ENV(CLANG38_BIN)clang
+
+*_CLANG38_ARM_SLINK_PATH         = ENV(CLANG38_BIN)llvm-ar
+*_CLANG38_ARM_RC_PATH            = ENV(CLANG38_ARM_PREFIX)objcopy
+
+*_CLANG38_ARM_ASLCC_FLAGS        = DEF(GCC_ASLCC_FLAGS)
+*_CLANG38_ARM_ASLDLINK_FLAGS     = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_ASLDLINK_FLAGS)
+*_CLANG38_ARM_ASM_FLAGS          = DEF(GCC_ASM_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments
+*_CLANG38_ARM_DLINK2_FLAGS       = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
+*_CLANG38_ARM_PLATFORM_FLAGS     = -march=armv7-a
+*_CLANG38_ARM_PP_FLAGS           = DEF(GCC_PP_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG38_ARM_RC_FLAGS           = DEF(GCC_ARM_RC_FLAGS)
+*_CLANG38_ARM_VFRPP_FLAGS        = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG38_ARM_ASLPP_FLAGS        = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_ARM_TARGET)
+*_CLANG38_ARM_CC_XIPFLAGS        = DEF(GCC_ARM_CC_XIPFLAGS)
+
+  DEBUG_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3
+  DEBUG_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3
+  NOOPT_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0
+  NOOPT_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS)
+RELEASE_CLANG38_ARM_CC_FLAGS     = DEF(CLANG38_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3
+RELEASE_CLANG38_ARM_DLINK_FLAGS  = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3
+
+##################
+# CLANG38 AARCH64 definitions
+##################
+DEFINE CLANG38_AARCH64_TARGET    = -target aarch64-linux-gnu
+DEFINE CLANG38_AARCH64_CC_FLAGS  = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG38_AARCH64_TARGET) -mcmodel=small DEF(CLANG38_WARNING_OVERRIDES)
+DEFINE CLANG38_AARCH64_DLINK_FLAGS  = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
+
+*_CLANG38_AARCH64_PP_FLAGS       = DEF(GCC_PP_FLAGS)
+*_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS)
+*_CLANG38_AARCH64_APP_FLAGS      =
+*_CLANG38_AARCH64_ASL_FLAGS      = DEF(IASL_FLAGS)
+*_CLANG38_AARCH64_ASL_OUTFLAGS   = DEF(IASL_OUTFLAGS)
+*_CLANG38_AARCH64_DTCPP_FLAGS    = DEF(GCC_DTCPP_FLAGS)
+
+*_CLANG38_AARCH64_CC_PATH        = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_ASM_PATH       = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_PP_PATH        = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_VFRPP_PATH     = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_ASLCC_PATH     = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_ASLPP_PATH     = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_DLINK_PATH     = ENV(CLANG38_BIN)clang
+*_CLANG38_AARCH64_ASLDLINK_PATH  = ENV(CLANG38_BIN)clang
+
+*_CLANG38_AARCH64_SLINK_PATH     = ENV(CLANG38_BIN)llvm-ar
+*_CLANG38_AARCH64_RC_PATH        = ENV(CLANG38_AARCH64_PREFIX)objcopy
+
+*_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS)
+*_CLANG38_AARCH64_ASLDLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS)
+*_CLANG38_AARCH64_ASM_FLAGS      = DEF(GCC_ASM_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments
+*_CLANG38_AARCH64_DLINK_FLAGS    = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000
+*_CLANG38_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
+*_CLANG38_AARCH64_DLINK2_FLAGS   = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
+*_CLANG38_AARCH64_PLATFORM_FLAGS =
+*_CLANG38_AARCH64_PP_FLAGS       = DEF(GCC_PP_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG38_AARCH64_RC_FLAGS       = DEF(GCC_AARCH64_RC_FLAGS)
+*_CLANG38_AARCH64_VFRPP_FLAGS    = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
+*_CLANG38_AARCH64_ASLPP_FLAGS    = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_AARCH64_TARGET)
+*_CLANG38_AARCH64_CC_XIPFLAGS    = DEF(GCC_AARCH64_CC_XIPFLAGS)
+
+  DEBUG_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3
+  DEBUG_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3
+  NOOPT_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0
+  NOOPT_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS)
+RELEASE_CLANG38_AARCH64_CC_FLAGS    = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O3
+RELEASE_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3
+
 ####################################################################################
 #
 # Cygwin GCC And Intel ACPI Compiler