llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

clang -flto -Os/-Oz passes -Os/-Oz to lld (but lld doesn't know what to do with it)

Open berolinux opened this issue 7 years ago • 9 comments

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)

berolinux avatar Jun 29 '19 11:06 berolinux

mentioned in issue llvm/llvm-bugzilla-archive#45913

MaskRay avatar Nov 27 '21 03:11 MaskRay

Fixed by https://reviews.llvm.org/D79919 5ecb51414637402b0f89a96924ac7b015d23bcfa (will be included in llvm 11)

MaskRay avatar May 14 '20 17:05 MaskRay

*** Bug llvm/llvm-bugzilla-archive#45913 has been marked as a duplicate of this bug. ***

MaskRay avatar May 13 '20 21:05 MaskRay

*** Bug llvm/llvm-project#41446 has been marked as a duplicate of this bug. ***

yuanfang-chen avatar Dec 25 '19 04:12 yuanfang-chen

Just FYI, the review is here: https://reviews.llvm.org/D63976

ormris avatar Jul 01 '19 16:07 ormris

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

fhahn avatar Jun 30 '19 20:06 fhahn

*** Bug llvm/llvm-project#41478 has been marked as a duplicate of this bug. ***

berolinux avatar Jun 29 '19 19:06 berolinux

*** Bug llvm/llvm-project#41477 has been marked as a duplicate of this bug. ***

berolinux avatar Jun 29 '19 19:06 berolinux

assigned to @MaskRay

berolinux avatar Jun 29 '19 11:06 berolinux