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

            Bug ID: 28385
           Summary: gold: linker script symbol assignment given wrong
                    visibility with versioning script
           Product: binutils
           Version: 2.37
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: vapier at gentoo dot org
                CC: ian at airs dot com
  Target Milestone: ---

the attr package uses a linker script to set up compatibility symbols, and a
versioning script to set up the visibility.  bfd handles this, but gold sets
the wrong visibility.

in the test below you can see bfd puts symtest_o@SYM_1.0 in the exported dynsym
but gold does not.

$ cat test.c
void symtest_new() {}
void symtest_old() {}

$ cat test.lds 
"symtest_o@SYM_1.0" = symtest_old;

$ cat test.ver
SYM_1.0 {
global: symtest_o;
local: *;
};
SYM_1.1 {
global: symtest_new;
};

$ gcc -fPIC -shared test.c -Wl,--version-script=test.ver -Wl,test.lds -o
libtest.so -fuse-ld=bfd
$ readelf -sW libtest.so | grep -i sym
Symbol table '.dynsym' contains 9 entries:
     5: 0000000000001100     0 FUNC    GLOBAL DEFAULT   11 symtest_o@SYM_1.0
     6: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS SYM_1.0
     7: 00000000000010f9     7 FUNC    GLOBAL DEFAULT   11 symtest_new@@SYM_1.1
     8: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS SYM_1.1
Symbol table '.symtab' contains 19 entries:
     6: 0000000000001100     7 FUNC    LOCAL  DEFAULT   11 symtest_old
    11: 0000000000001100     0 FUNC    GLOBAL DEFAULT   11 symtest_o@SYM_1.0
    13: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS SYM_1.0
    15: 00000000000010f9     7 FUNC    GLOBAL DEFAULT   11 symtest_new
    16: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS SYM_1.1

$ gcc -fPIC -shared test.c -Wl,--version-script=test.ver -Wl,test.lds -o
libtest.so -fuse-ld=gold
$ readelf -sW libtest.so | grep symtest
Symbol table '.dynsym' contains 8 entries:
     5: 00000000000005e9     7 FUNC    GLOBAL DEFAULT   12 symtest_new@@SYM_1.1
     6: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS SYM_1.0
     7: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS SYM_1.1
Symbol table '.symtab' contains 20 entries:
     5: 00000000000005f0     7 FUNC    LOCAL  DEFAULT   12 symtest_old
     8: 00000000000005f0     0 FUNC    LOCAL  DEFAULT   12 symtest_o@SYM_1.0
    13: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS SYM_1.1
    14: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS SYM_1.0
    15: 00000000000005e9     7 FUNC    GLOBAL DEFAULT   12 symtest_new

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

Reply via email to