bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gold/28139] New: ld.gold fails while ld.bfd succeeds: error: reloca


From: slyfox at inbox dot ru
Subject: [Bug gold/28139] New: ld.gold fails while ld.bfd succeeds: error: relocation refers to local symbol "" [2], which is defined in a discarded section
Date: Sun, 25 Jul 2021 21:35:09 +0000

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]