bug-binutils
[Top][All Lists]
Advanced

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

[Bug gold/28196] New: gold: if .symtab order is: __free_hook, __free_hoo


From: i at maskray dot me
Subject: [Bug gold/28196] New: gold: if .symtab order is: __free_hook, __free_hook@GLIBC_2.2.5, version script incorrectly makes the symbol default versioned
Date: Thu, 05 Aug 2021 18:03:37 +0000

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

            Bug ID: 28196
           Summary: gold: if .symtab order is: __free_hook,
                    __free_hook at GLIBC_2 dot 2.5, version script incorrectly
                    makes the symbol default versioned
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: i at maskray dot me
                CC: ian at airs dot com
  Target Milestone: ---

cat > ./a.s <<eof
.symver __free_hook, __free_hook@GLIBC_2.2.5
.weak __free_hook
__free_hook:
  nop
  call __free_hook
eof
echo 'GLIBC_2.2.5 { __free_hook; };' > ./a.ver
as a.s -o a.o
gold -shared --version-script=a.ver a.o -o a.so
gold -r a.o -o b.o
gold -shared --version-script=a.ver b.o -o b.so
exit

In b.o's .symtab, __free_hook@GLIBC_2.2.5 is before __free_hook.
gold can incorrectly make __free_hook default versioned.

% readelf -W --dyn-syms a.so | grep free_hook
     5: 00000000000002c8     0 NOTYPE  WEAK   DEFAULT    7
__free_hook@GLIBC_2.2.5
% readelf -W --dyn-syms b.so | grep free_hook
     5: 00000000000002c8     0 NOTYPE  WEAK   DEFAULT    7
__free_hook@@GLIBC_2.2.5

% readelf -Ws a.o
...
     1: 0000000000000000     0 NOTYPE  WEAK   DEFAULT    1 __free_hook
     2: 0000000000000000     0 NOTYPE  WEAK   DEFAULT    1
__free_hook@GLIBC_2.2.5
% readelf -Ws b.o
...
     1: 0000000000000000     0 NOTYPE  WEAK   DEFAULT    1
__free_hook@GLIBC_2.2.5
     2: 0000000000000000     0 NOTYPE  WEAK   DEFAULT    1 __free_hook

(
Aside:
`.symver foo, foo@v1, remove` is created which can make this problem moot.

I repeated many times in https://sourceware.org/bugzilla/show_bug.cgi?id=25295
and some other threads, `, remove` should just be the default behavior of
`.symver foo, foo@v1` when foo is defined.
.symver should just behave like "rename".
I guess probably only glibc may be unhappy with the default `, remove`.
The fix is probably not too difficult.

Of course, gas should be fixed first to make relocation symbols versioned: PR
gas/28157
)

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