bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/27210] New: ld: Don't suppress foo if foo@v1 is defined


From: i at maskray dot me
Subject: [Bug ld/27210] New: ld: Don't suppress foo if foo@v1 is defined
Date: Tue, 19 Jan 2021 22:31:48 +0000

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

            Bug ID: 27210
           Summary: ld: Don't suppress foo if foo@v1 is defined
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: i at maskray dot me
  Target Milestone: ---

cat > a.s <<eof
.globl foo
.symver foo, foo@v1
foo: nop
eof
echo 'v1 {};' > a.ver
cat > b.s <<eof
.globl  foo_v1
foo_v1: nop
.symver foo_v1, foo@v1
eof

exit


GNU ld has a special rule removing foo if foo@v1 is defined. gold and LLD don't
have the special rule.
I think the gold/LLD behavior makes more sense.

Building glibc does not need the GNU ld special rule. The 30000+ FreeBSD ports
work with the LLD behavior.
People know that non-default versions should use a different original symbol
name.
So dropping the special rule is likely safe.

% gcc -shared -fuse-ld=bfd a.s -nostdlib -Wl,--version-script=a.ver -o a.bfd.so
&& readelf -W --dyn- a.bfd.so

Symbol table '.dynsym' contains 4 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000001000     0 NOTYPE  GLOBAL DEFAULT    7 foo@v1
     2: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS v1
     3: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS v2

% gcc -shared -fuse-ld=gold a.s -nostdlib -Wl,--version-script=a.ver -o
a.gold.so && readelf -W --dyn- a.gold.so

Symbol table '.dynsym' contains 8 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000002000     0 NOTYPE  GLOBAL DEFAULT    8 _end
     2: 0000000000002000     0 NOTYPE  GLOBAL DEFAULT    8 _edata
     3: 000000000000034c     0 NOTYPE  GLOBAL DEFAULT    7 foo@v1
     4: 000000000000034c     0 NOTYPE  GLOBAL DEFAULT    7 foo
     5: 0000000000002000     0 NOTYPE  GLOBAL DEFAULT    8 __bss_start
     6: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS v1
     7: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS v2

For b.s, both foo_v1 and foo@v1 are present.

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