azat added a comment.

> I think @MaskRay was saying this doesn't actually work & different flags are 
> needed to pass to lld

I thought that @MaskRay was talking about more generic approach that will not 
require if for the linker name, and indeed 
`--plugin-opt=-generate-arange-section` is better, and both `gold` and `bfd` 
support it!

> have you tested this end-to-end/with a real compilation, does that work? (are 
> there other cases that already use -mllvm to pass flags down to lld?)

Sure:

  $ cat test.c
  void __attribute__((optnone)) bar()
  {
  }
  void __attribute__((optnone)) foo()
  {
          bar();
  }
  int main()
  {
          foo();
  }
  $ clang -c -flto=thin -fuse-ld=lld -gdwarf-aranges -g -O3 test.c
  $ clang -flto=thin -fuse-ld=lld -gdwarf-aranges -g -O3 test.c -### # to get 
full command
  $ /usr/bin/ld.lld ... -mllvm -generate-arange-section
  $ eu-readelf -waranges a.out  | grep -F -c -e foo -e bar
  2


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133875

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to