clang -flto -Os/-Oz passes -Os/-Oz to lld (but lld doesn't know what to do with it)
| Bugzilla Link | 42445 |
| Resolution | FIXED |
| Resolved on | May 14, 2020 10:40 |
| Version | trunk |
| OS | Linux |
| Attachments | Proposed patch |
| CC | @BalaRishi-AMD,@fhahn,@MaskRay,@m-gupta,@ormris,@pogo59,@zygoloid |
Extended Description
clang with -flto passes optimization levels to lld unmodified -- even if the optimization level is one lld doesn't understand, such as -Os or -Oz.
This makes -flto with -Os/-Oz unusable.
$ clang -Os -fuse-ld=lld -flto test.c ld.lld: error: -plugin-opt=Os: number expected, but got 's' clang-9: error: linker command failed with exit code 1 (use -v to see invocation) $ clang -Oz -fuse-ld=lld -flto test.c ld.lld: error: -plugin-opt=Oz: number expected, but got 'z' clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
mentioned in issue llvm/llvm-bugzilla-archive#45913
Fixed by https://reviews.llvm.org/D79919 5ecb51414637402b0f89a96924ac7b015d23bcfa (will be included in llvm 11)
*** Bug llvm/llvm-bugzilla-archive#45913 has been marked as a duplicate of this bug. ***
*** Bug llvm/llvm-project#41446 has been marked as a duplicate of this bug. ***
Just FYI, the review is here: https://reviews.llvm.org/D63976
Created attachment 22164 [details] Proposed patch
Hi Bernhard! It looks like you attached a proposed fix here. It would be great if you could share it for code-review on Phabricator or llvm-commits, so the right people can have a look and comment: https://llvm.org/docs/Contributing.html
*** Bug llvm/llvm-project#41478 has been marked as a duplicate of this bug. ***
*** Bug llvm/llvm-project#41477 has been marked as a duplicate of this bug. ***
assigned to @MaskRay