[cfe-dev] Question about LTO pass driver level flags to the plugin

Zakk zakk0610 at gmail.com
Fri Aug 23 01:47:51 PDT 2013


Hi all,
I often meet the problem cause by Link::ConstructJob does not pass
driver level flags relevant to LTO code generation down to the plugin.
So when I compile program like:
clang -c a.c -o a.o -mcpu=cortex-a9 -mfloat-abi=hard -mfpu=vfpv3 -flto
clang -c main.c -o main.o  -mcpu=cortex-a9 -mfloat-abi=hard -mfpu=vfpv3
clang a.o main.o -o main -mcpu=cortex-a9 -mfloat-abi=hard -mfpu=vfpv3 -flto

I will got error like:
ld: error: lto-llvm.o-SchABH uses VFP register arguments, output does not

So I need to modify Link::ConstructJob to pass
"-plugin-opt=-float-abi=hard" and vfpv3 feature to the plugin.
It's tedious because some option may be missed in LTO code generation.
For example when I add a new option to llc, and add the same one in clang,
I also need to modify Link::ConstructJob to pass this option to plugin...
Is there a more general solution?

Thanks.
-- 
Best regards,
Kuan-Hsu Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130823/df668867/attachment.html>


More information about the cfe-dev mailing list