Open rui314 opened 6 years ago
mentioned in issue llvm/llvm-bugzilla-archive#36035
Lets reassign to clang for now as both lld and the gold plugin reject this.
Is there any issue here? Seems invalid for me.
Should it work with gold ? Does not work for me, looks like expected behavior actually:
~/LLVM/build_goldplugin/bin/clang -fuse-ld=gold -Os -flto=thin 1.cpp -o out -v
...
"/usr/local/bin/ld.gold" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o out /usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/7.2.0/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/7.2.0 -L/usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../.. -L/home/umb/LLVM/build_goldplugin/bin/../lib -L/lib -L/usr/lib -plugin /home/umb/LLVM/build_goldplugin/bin/../lib/LLVMgold.so -plugin-opt=mcpu=x86-64 -plugin-opt=Os -plugin-opt=thinlto /tmp/1-f9536b.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/7.2.0/crtend.o /usr/lib/gcc/x86_64-linux-gnu/7.2.0/../../../x86_64-linux-gnu/crtn.o /usr/local/bin/ld.gold: fatal error: Optimization level must be between 0 and 3 clang-7.0: error: linker command failed with exit code 1 (use -v to see invocation)
What I do not understand is that gold plugin doesn't take -plugin-opt=Os as well.
How does it work?
there's no Os for LTO, as far as I can tell. So you can probably ignore?
Extended Description
Clang passes -plugin-opt=Os to lld when LTO is enabled and -Os is passed. lld does not recognize the flag. It shows the following error message:
ld.lld: error: --plugin-opt: number expected, but got 's'