Hello Ard, > > Hello Steven, > > On 3 August 2016 at 08:48, Shi, Steven <steven....@intel.com> wrote: > > This adds support for LLVM 3.8.x in LTO mode for IA32 and X64. > > CLANG38 enable LLVM Link Time Optimization (LTO) and code size > > optimization flag (-Oz) by default for aggressive code size > > improvement. CLANG38 X64 code is small code model + PIE. > > > > CLANG LTO needs PIE in link flags to generate PIE code correctly, > > otherwise the PIE is not really enabled. (e.g. OvmfPkgX64 will > > hang in 64bits SEC at high address because of small model code > > displacement overflow). > > > > This is probably caused by the same issue I am addressing with the > series I sent out yesterday, to pass the CC flags to the DLINK > command. > > The reason is that code is generated by the link pass, so it needs to > see the same -fpie -mcmodel=small options that we passed to the > compiler as wel. > > Could you check whether replacing '-Wl,-pie' with -fpie does the trick > as well? As I mentioned before, creating a PIE executable at link time > is not the same as generatic position independent code at compile time > (whether it is via $(CC) or via $(DLINK)). The PIE executable will > contain a .rela section that partially overlaps with other absolute > relocations, so it is best to avoid it.
[Steven]: I just tried it. No, replacing '-Wl,-pie' with -fpie cannot works for clang38. With -fpie in link flags, the OvmfPkgX64 still hang in 64bits SEC at high address. > > Some more comments below > > > +*_CLANG38_IA32_OBJCOPY_PATH = DEF(GCC5_IA32_PREFIX)objcopy > > Why are you using the GCC5 prefix here? A clang user may not set GCC5_BIN > [Steven]: OK, I will remove the GCC5 prefix. > > +*_CLANG38_IA32_ASLCC_FLAGS = -x c -Os -m32 > DEF(CLANG38_IA32_TARGET) -flto > > Does LTO make any sense for ACPI tables? > [Steven]: OK, I will follow GCC5 to disable the LTO for ASLCC flags. Thanks Steven _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel