https://sourceware.org/bugzilla/show_bug.cgi?id=29573
Bug ID: 29573 Summary: binutils don't display location of global variable Product: binutils Version: 2.38 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: trass3r at gmail dot com Target Milestone: --- int bar() { return 5; } const int foo = bar(); int main() {} $ g++ -Og -g -gdwarf-4 test.cpp -o test $ nm -SlaC --size-sort test 0000000000004010 0000000000000001 b completed.0 0000000000002000 0000000000000004 R _IO_stdin_used 0000000000004014 0000000000000004 b foo 0000000000001129 000000000000000a T bar() /tmp/test.cpp:1 000000000000114e 000000000000000a T main /tmp/test.cpp:3 0000000000001158 0000000000000014 t _GLOBAL__sub_I__Z3barv 0000000000001133 000000000000001b t __static_initialization_and_destruction_0(int, int) /tmp/test.cpp:3 000000000000038c 0000000000000020 r __abi_tag $ addr2line -e test 4014 ??:? $ objdump -g test <1><2e>: Abbrev Number: 5 (DW_TAG_variable) <2f> DW_AT_name : foo <33> DW_AT_decl_file : 1 <34> DW_AT_decl_line : 2 <35> DW_AT_decl_column : 11 <36> DW_AT_type : <0x4b> <3a> DW_AT_location : 9 byte block: 3 14 40 0 0 0 0 0 0 (DW_OP_addr: 4014) Same with -gdwarf-5 or clang++ -O0. gcc 12.2, clang 14.0.6 -- You are receiving this mail because: You are on the CC list for the bug.