[PATCH] D79818: [lld] Support size levels with (Thin)LTO

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 16:57:17 PDT 2020


pcc added a comment.

In D79818#2035301 <https://reviews.llvm.org/D79818#2035301>, @phosek wrote:

> In D79818#2035232 <https://reviews.llvm.org/D79818#2035232>, @MaskRay wrote:
>
> > @mehdi_amini @pcc @tejohnson
> >
> > I just saw another issue saying that `clang -Os -flto=thin a.c` does not work https://bugs.llvm.org/show_bug.cgi?id=45913 (+ @manojgupta)
> >  I marked it as yet another duplicate of PR42445
> >
> > For -Os, clang driver passes -plugin-opt=Os (https://github.com/llvm/llvm-project/blob/master/clang/lib/Driver/ToolChains/CommonArgs.cpp#L402) but neither LLVMgold.so nor LLD recognizes `-plugin-opt=Os`. 
> >  -Oz is similar. What is the concrete suggestion here? For quick reference, the `-plugin-opt=O` logic was added by rL256146 <https://reviews.llvm.org/rL256146>.
>
>
> The issue form my perspective is the inconsistency. Today, lld accepts `-plugin-opt=O<number>` but it doesn't accept `-plugin-opt=O<letter>`, but Clang automatically translates `-O<anything>` to `-plugin-opt=O<anything>` which results in a failure when your try to use `-Os`, `-Oz` or `-Og` with (Thin)LTO.


This is where the bug is then. The clang driver should be translating these arguments to `-plugin-opt O2`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79818/new/

https://reviews.llvm.org/D79818





More information about the llvm-commits mailing list