[PATCH] D74169: [WIP][LLD][ELF][DebugInfo] Remove obsolete debug info.
Alexey Lapshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 3 14:39:06 PDT 2020
avl added a comment.
> But good to check/ask - @avl does this patch already do the good things for duplicate (or dropped) function sections?
> (eg: "inline void f1() { } void f2() { f1(); }" + "inline void f1() { } void f2(); int main() { f1(); f2(); }" compiled and linked at -O0 the DWARF would usually contain two descriptions of 'f1', but ideally with a DWARF aware linker it'd contain only one description of 'f1'. Similarly: "void f1() { } void f2() { }" + "void f2(); int main() { f2(); }" compiled and linked with -ffunction-sections -Wl,-gc-sections would normally contain a DWARF description of "f1" but no code for f1, and a DWARF aware linker would strip out the DWARF description of 'f1' here)
right. It generates one copy:
$cat test1.cpp
inline void f1() { } void f2(); int main() { f1(); f2(); }
$cat test2.cpp
inline void f1() { } void f2() { f1(); }
$ clang++ test1.cpp test2.cpp -O0 -g -ffunction-sections -fuse-ld=lld -Wl,--gc-sections; llvm-dwarfdump -a a.out | grep "\"f1\""
DW_AT_name ("f1")
DW_AT_name ("f1")
0x00000098: "f1"
$ clang++ test1.cpp test2.cpp -O0 -g -ffunction-sections -fuse-ld=lld -Wl,--gc-sections,--gc-debuginfo; llvm-dwarfdump -a a.out | grep "\"f1\""
DW_AT_name ("f1")
0x0000008b: "f1"
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74169/new/
https://reviews.llvm.org/D74169
More information about the llvm-commits
mailing list