[PATCH] D133875: [clang] fix generation of .debug_aranges with LTO (resubmit)
Azat Khuzhin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 14 13:38:53 PDT 2022
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
More information about the cfe-commits
mailing list