On 17 August 2016 at 13:38, Shi, Steven <[email protected]> wrote: > Hi Ard, > > CLANG38 has a build failure as below for this patch. This failure is because > the CLANG38 enable the LTO through LLVMgold.so linker plugin, but the > LLVMgold.so plugin cannot accept the clang -Oz cc flag as build option. > After CC_FLAG is added in the link rule, the LLVMgold.so plugin reports link > error. LLVMgold.so only accept -O0~-O3, and you can see it in the LLVM gold > plugin source code in below: >
This is interesting. I tried enabling LTO with CLANG35 for AARCH64 (using a 3.7 binary) and I did not see this problem. > > > http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_380/final/tools/gold/gold-plugin.cpp > > > > if (opt[1] < '0' || opt[1] > '3') > > line173: message(LDPL_FATAL, "Optimization level must be between 0 > and 3"); > > > > I hope to know is it mandatory to add compiler CC_FLAG in the linker rule > for you? If it is mandatory, I have to introduce a new link rule for CLANG38 > to remove the compiler CC_FLAG. What do you think? > Yes, it is mandatory. And I consider this a bug in Clang. For example, the mcmodel=xxx parameter *must* be passed to the linker, since the linker generates code itself under LTO, and needs to know for which code model it is doing so. The same applies to -fpie and -mstrict-align (although clang also requires the -pie linker flag to generate correct code) Could you try putting -O2 in the DLINK2_FLAGS for Clang 38? (i.e., so that the last -O option the linker sees is not -Oz) -- Ard. _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

