https://sourceware.org/bugzilla/show_bug.cgi?id=28139
Bug ID: 28139 Summary: ld.gold fails while ld.bfd succeeds: error: relocation refers to local symbol "" [2], which is defined in a discarded section Product: binutils Version: 2.37 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gold Assignee: ccoutant at gmail dot com Reporter: slyfox at inbox dot ru CC: ian at airs dot com Target Milestone: --- Initially reported by Dennis Schridde in https://bugs.gentoo.org/803173 as a systemd-249.1 build failure when linked with ld.gold. Here is ane xtracted example (needs systemtap header) that illustrates the failure on x86_64: $ cat bug.c #include <sys/sdt.h> void f(void *dev) { STAP_PROBE("foo", "foo"); } int main(){} ld.gold fails: $ x86_64-pc-linux-gnu-gcc -O2 -fno-PIE -fno-stack-protector -o b.o -c bug.c $ x86_64-pc-linux-gnu-gcc -O2 -fno-PIE -fno-stack-protector -Wl,--gc-sections -Wl,-O1 -fuse-ld=gold b.o -o bug b.o(.note.stapsdt+0x14): error: relocation refers to local symbol "" [2], which is defined in a discarded section collect2: error: ld returned 1 exit status ld.bfd succeeds: $ x86_64-pc-linux-gnu-gcc -O2 -fno-PIE -fno-stack-protector -Wl,--gc-sections -Wl,-O1 -fuse-ld=bfd b.o -o bug Looks like -Wl,--gc-sections does too much for ld.gols. Which one is wrong here? -- You are receiving this mail because: You are on the CC list for the bug.