bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/22220] New: BFD linker plugin wrongly marks symbols as PREVAILIN


From: mliska at suse dot cz
Subject: [Bug ld/22220] New: BFD linker plugin wrongly marks symbols as PREVAILING_DEF_IRONLY
Date: Wed, 27 Sep 2017 07:38:43 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=22220

            Bug ID: 22220
           Summary: BFD linker plugin wrongly marks symbols as
                    PREVAILING_DEF_IRONLY
           Product: binutils
           Version: 2.28
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: mliska at suse dot cz
  Target Milestone: ---

As mentioned here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82172,
ld.bfd marks following symbol of libstdc++:

$ readelf -s /usr/lib64/gcc/x86_64-suse-linux/7/libstdc++.so --wide | grep
_ZNSs4_Rep20_S_empty_rep_storageE
  4310: 0000000000388d40    32 OBJECT  UNIQUE DEFAULT   28
_ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4

as:
grep storage pr82172-2.res 
1322 8b73ecc64ca986c5 PREVAILING_DEF_IRONLY _ZNSs4_Rep20_S_empty_rep_storageE

Which is wrong because it's a static member of basic_string class and it has
many references from libstdc++.so itself.

$ ld --version
GNU ld (GNU Binutils; openSUSE Tumbleweed) 2.28.0.20170331-2

On the other hand, ld.gold works fine:

grep storage pr82172-2.res 
1322 2800fe9d29715552 PREVAILING_DEF_IRONLY_EXP
_ZNSs4_Rep20_S_empty_rep_storageE

I have a small reproducer, which shows difference of ld.gold and ld.bfs
(PREVAILING_DEF_IRONLY_EXP vs. PREVAILING_DEF_IRONLY_EXP), hopefully will be
useful:

$ cat test.h
extern int doo();

inline int *goo() {
        static int xyz;
        return &xyz;
}

int *boo();

$ cat lib.c
#include "test.h"

int* boo() {
  return goo ();
}

$ cat main.c
#include "test.h"

int main()
{
  if (boo() == goo())
  __builtin_printf("good: %p\n", goo());
}

$ g++ lib.c  -shared -fPIC -o libtest.so
$ g++ main.c -ltest -L. -flto -O2 --save-temps && grep xyz main.res
232 a8edc87dd4d6628a PREVAILING_DEF _ZZ3goovE3xyz

Reproducer for the original issue is here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82172#c10

Thanks

-- 
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]