https://bugs.llvm.org/show_bug.cgi?id=41124
Bug ID: 41124
Summary: llvm-symbolizer shows incorrect source line info if
--gc-sections used
Product: tools
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: llvm-symbolizer
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
llvm-symbolizer shows incorrect source line info if --gc-sections used:
$ cat not_used.cpp
void foo () {
__asm__(".rept 3300000; nop; .endr");
}
$ cat main.cpp
int main(void) {
return 0;
}
$ clang++ -gdwarf-5 -O not_used.cpp -c
$ clang++ -gdwarf-5 -O main.cpp -c
$ clang++ -gdwarf-5 -O not_used.o main.o -fuse-ld=lld -Wl,--gc-sections -o
res.out
$ llvm-symbolizer -obj=res.out 0x2010f0
main
/home/avl/bugs/gc_debuginfo/not_used.cpp:2:5
Note: llvm-symbolizer reported wrong source file - not_used.cpp !!!
The reason for the failure is that linker while removing not used
sections(-Wl,--gc-sections) keeps debug info for not used code :
llvm-dwarfdump -a res.out
0x0000000c: DW_TAG_compile_unit
DW_AT_producer ("clang version 9.0.0)
DW_AT_language (DW_LANG_C_plus_plus)
DW_AT_name ("not_used.cpp")
DW_AT_str_offsets_base (0x00000008)
DW_AT_stmt_list (0x00000000)
DW_AT_addr_base (0x00000008)
DW_AT_low_pc (0x0000000000000000) <<<<<<<<<<<<<<<<<<<<<<
DW_AT_high_pc (0x0000000000325aa1) <<<<<<<<<<<<<<<<<<<<<<
0x0000003c: DW_TAG_compile_unit
DW_AT_producer ("clang version 9.0.0)
DW_AT_language (DW_LANG_C_plus_plus)
DW_AT_name ("main.cpp")
DW_AT_str_offsets_base (0x00000024)
DW_AT_stmt_list (0x00000075)
DW_AT_addr_base (0x00000018)
DW_AT_low_pc (0x00000000002010f0) <<<<<<<<<<<<<<<<<<<<<<
DW_AT_high_pc (0x00000000002010f3) <<<<<<<<<<<<<<<<<<<<<<
Note compilation units from debug info have overlapping address ranges.
I have a fix for that problem.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs