https://sourceware.org/bugzilla/show_bug.cgi?id=27587
Bug ID: 27587 Summary: BFD (and gold) DWARF reader choke on DWARF5 as generated by LTO Product: binutils Version: 2.35.1 Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- When BFD ld or gold emit diagnostics they seem to try parse the DWARF in the object files but they somehow choke if the objects are generated with -gdwarf-5 as opposed to -gdwarf-4 and contain references to abstract DIEs in other CUs (residing in other object files). Like so: > ./xgcc -B. -gdwarf-5 -Werror -O2 t.i -flto -g > /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: > /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: > DWARF error: invalid abstract instance DIE ref /tmp/cch4tY4L.ltrans0.ltrans.o: in function `main': <artificial>:(.text.startup+0x1): undefined reference to `stack_size' collect2: error: ld returned 1 exit status where t.i is char main_prompt[1]; int sprintf(char *, char *, ...); void stack_size(); void main() { sprintf(main_prompt, "", stack_size); } or simply invoking ld with the object files: > ld -o a.out a-t.o.debug.temp.o ./a.ltrans0.ltrans.o ld: warning: cannot find entry symbol _start; defaulting to 00000000004000f0 ld: ld: DWARF error: invalid abstract instance DIE ref ./a.ltrans0.ltrans.o: in function `main': <artificial>:(.text.startup+0x1): undefined reference to `stack_size' ld: <artificial>:(.text.startup+0x12): undefined reference to `sprintf' fixing the error by providing a stack_size definition in x.o: > ld -o a.out a-t.o.debug.temp.o ./a.ltrans0.ltrans.o x.o -lc ld: warning: cannot find entry symbol _start; defaulting to 00000000004002c0 and the issue is gone. -- You are receiving this mail because: You are on the CC list for the bug.