https://sourceware.org/bugzilla/show_bug.cgi?id=26530
            Bug ID: 26530
           Summary: Inconsistency in between bfd and gold about
                    -Wl,--as-needed
           Product: binutils
           Version: 2.34
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: mliska at suse dot cz
  Target Milestone: ---

Let's consider the following example:

$ cat foo.c
const char *lrealpath(const char *a)
{
  return a;
}

$ cat main.c
const char *lrealpath(const char *a);

int main(int argc, char **argv)
{
  lrealpath (argv[0]);
}

$ gcc foo.c -fPIC -flto -c
$ ar r libtest.a foo.o
$ gcc -o libfoo.so foo.o -shared

$ gcc main.o -Wl,--as-needed libfoo.so libtest.a --save-temps -fuse-ld=bfd -L.
&& cat libtest.res
2
main.o 2
200 6e870bd31e7efa23 PREVAILING_DEF main
206 6e870bd31e7efa23 RESOLVED_IR lrealpath
libtest.a@0x92 1
199 76b392265247fa61 PREVAILING_DEF_IRONLY_EXP lrealpath

while gold does:

$ gcc main.o -Wl,--as-needed libfoo.so libtest.a --save-temps -fuse-ld=gold -L.
&& cat libtest.res
1
main.o 2
200 6e870bd31e7efa23 PREVAILING_DEF main
206 6e870bd31e7efa23 RESOLVED_DYN lrealpath

So BFD takes symbols from LTO IR while GOLD takes them from the shared library.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to