On 27 December 2015 at 20:22, Leif Lindholm <[email protected]> wrote: > On Sun, Dec 27, 2015 at 08:08:27PM +0100, Ard Biesheuvel wrote: >> On 27 December 2015 at 19:06, Leif Lindholm <[email protected]> wrote: >> > On Thu, Dec 24, 2015 at 02:03:14PM +0100, Ard Biesheuvel wrote: >> >> Since we are combining Clang with the GNU linker, make that explicit in >> >> the target triplet. This affects certain builtin defines and other >> >> compiler >> >> behavior that may be unspecified otherwise. >> > >> > Are there any potential conflicts here? >> > Is it a safe assumption that only clang versions supporting the >> > -linux-gnu* targets will be used to build ARM/AArch64 EDK2? >> > >> >> Our CLANG35 toolchain depends on the GNU binutils cross-linker, and I >> suppose it is possible to build Clang without such support. It is also >> possible to build Clang without any aarch64 support. FWIW, I can build >> ArmVirtQemu.dsc for AARCH64 with OSX's system clang and a >> cross-binutils installed. > > Yeah, my question was really more (based in a lack of understanding of > clang) - are we not actually removing support for toolchains that > worked with the initial round of AArch64 clang support? > > I mean, like GCC comes with aarch64-elf flavours in addition to the > aarch64-linux-gnu (both released by Linaro)? That should previously > have "just worked" when not explicitly specifying the full triplet, > but might now not? > > And if we're now restricting us to needing the -linux-gnu* support, > would this actually need forking out into something similar to the > ARMGCC/ARMLINUXGCC mess we had in the past in order to still work with > all armv7/aarch64-capable clang toolchains? >
We really need the -linux-gnu flavor here: $ clang -target aarch64 -dM -E - <<<""|grep __USER_LABEL_PREFIX__ #define __USER_LABEL_PREFIX__ _ $ clang -target aarch64-linux-gnu -dM -E - <<<""|grep __USER_LABEL_PREFIX__ #define __USER_LABEL_PREFIX__ $ clang -target aarch64-none-gnu -dM -E - <<<""|grep __USER_LABEL_PREFIX__ #define __USER_LABEL_PREFIX__ _ (__USER_LABEL_PREFIX__ is used to set ASM_PFX in the EDK2 header files) This simply means that your Clang is not suitable for building EDK2 combined with GNU binutils if it does not support the -linux-gnu targets. This is because LD does not decorate with leading underscores. >> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> >> Signed-off-by: Ard Biesheuvel <[email protected]> >> >> --- >> >> BaseTools/Conf/tools_def.template | 11 +++++++---- >> >> 1 file changed, 7 insertions(+), 4 deletions(-) >> >> >> >> diff --git a/BaseTools/Conf/tools_def.template >> >> b/BaseTools/Conf/tools_def.template >> >> index 6e26bbca934b..8d3f20999303 100644 >> >> --- a/BaseTools/Conf/tools_def.template >> >> +++ b/BaseTools/Conf/tools_def.template >> >> @@ -5183,9 +5183,12 @@ RELEASE_GCC49_AARCH64_CC_FLAGS = >> >> DEF(GCC49_AARCH64_CC_FLAGS) -Wno-unused-but-s >> >> *_CLANG35_*_ASLCC_PATH = ENV(CLANG35_BIN)clang >> >> *_CLANG35_*_ASLPP_PATH = ENV(CLANG35_BIN)clang >> >> >> >> +DEFINE CLANG35_ARM_TARGET = -target armv7-none-linux-gnueabi >> >> +DEFINE CLANG35_AARCH64_TARGET = -target aarch64-none-linux-gnu >> >> + >> >> DEFINE CLANG35_WARNING_OVERRIDES = -Wno-parentheses-equality >> >> -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare >> >> -Wno-empty-body >> >> -DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) -target armv7-a >> >> -mstrict-align -mllvm -arm-use-movt=0 DEF(CLANG35_WARNING_OVERRIDES) >> >> -DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) -target >> >> aarch64 -mcmodel=small -mstrict-align DEF(CLANG35_WARNING_OVERRIDES) >> >> +DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) >> >> DEF(CLANG35_ARM_TARGET) -mstrict-align -mllvm -arm-use-movt=0 >> >> DEF(CLANG35_WARNING_OVERRIDES) >> >> +DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) >> >> DEF(CLANG35_AARCH64_TARGET) -mcmodel=small -mstrict-align >> >> DEF(CLANG35_WARNING_OVERRIDES) >> >> >> >> ################## >> >> # CLANG35 ARM definitions >> >> @@ -5197,7 +5200,7 @@ DEFINE CLANG35_AARCH64_CC_FLAGS = >> >> DEF(GCC_AARCH64_CC_FLAGS) -target aarch64 -mc >> >> >> >> *_CLANG35_ARM_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) >> >> *_CLANG35_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS) >> >> -*_CLANG35_ARM_ASM_FLAGS = DEF(GCC_ASM_FLAGS) $(ARCHASM_FLAGS) >> >> $(PLATFORM_FLAGS) -target armv7-a -Qunused-arguments >> >> +*_CLANG35_ARM_ASM_FLAGS = DEF(GCC_ASM_FLAGS) >> >> DEF(CLANG35_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) >> >> -Qunused-arguments >> >> *_CLANG35_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) >> >> *_CLANG35_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) >> >> --defsym=PECOFF_HEADER_SIZE=0x220 >> >> *_CLANG35_ARM_PLATFORM_FLAGS = >> >> @@ -5218,7 +5221,7 @@ RELEASE_CLANG35_ARM_CC_FLAGS = >> >> DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(P >> >> >> >> *_CLANG35_AARCH64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) >> >> *_CLANG35_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_ASLDLINK_FLAGS) >> >> -*_CLANG35_AARCH64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) $(ARCHASM_FLAGS) >> >> $(PLATFORM_FLAGS) -target aarch64 -Qunused-arguments >> >> +*_CLANG35_AARCH64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) >> >> DEF(CLANG35_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) >> >> -Qunused-arguments >> >> *_CLANG35_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -z >> >> common-page-size=0x1000 >> >> *_CLANG35_AARCH64_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) >> >> --defsym=PECOFF_HEADER_SIZE=0x228 >> >> *_CLANG35_AARCH64_PLATFORM_FLAGS = >> >> -- >> >> 2.5.0 >> >> _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

