[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2019-03-20 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #42 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Alan Modra :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=980a2e42f7439015defdcedad89a13a72749bdb0

commit 980a2e42f7439015defdcedad89a13a72749bdb0
Author: Alan Modra 
Date:   Thu Mar 21 08:39:18 2019 +1030

lm32-linux ld testsuite fails

A number of the fails are due to ld supporting the creation of shared
libraries but not allowing linking against them without using an
option like -Bdynamic.
FAIL: Symbol export class test (final shared object)
FAIL: PROVIDE_HIDDEN test 4
FAIL: PROVIDE_HIDDEN test 6
FAIL: PROVIDE_HIDDEN test 10
FAIL: PROVIDE_HIDDEN test 12
FAIL: Build pr22471b.so
FAIL: Build pr22649-2b.so
FAIL: Build pr22649-2d.so
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned)
FAIL: PR ld/21233 dynamic symbols with section GC (--undefined)
FAIL: PR ld/21233 dynamic symbols with section GC (--require-defined)
FAIL: PR ld/21233 dynamic symbols with section GC (EXTERN)
FAIL: Build pr22150
FAIL: PR ld/14170
FAIL: Link using broken linker script
FAIL: pr17068 link --as-needed lib in group
FAIL: ld-gc/pr20022

* emulparams/elf32lm32fd.sh (DYNAMIC_LINK): Undef.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2018-07-02 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #41 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=12f09816cecc4e4ee7574a86846b3a17adbf7904

commit 12f09816cecc4e4ee7574a86846b3a17adbf7904
Author: Maciej W. Rozycki 
Date:   Mon Jul 2 23:57:22 2018 +0100

MIPS/BFD: Make section GC work with `ict_irix5' targets

Prevent runtime procedure table symbols, produced with `ict_irix5' MIPS
targets, from being swept in section GC, fixing linker errors like:

./ld-new: tmpdir/dump: protected symbol `_procedure_table_size' isn't
defined
./ld-new: final link failed: bad value

triggered whenever section GC is enabled with those targets and
consequently removing the following test suite failures:

FAIL: Build pr22649-2a.so
FAIL: Build pr22649-2c.so
FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared
library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned shared
library)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned)
FAIL: --gc-sections with .text._init
FAIL: pr20022

observed with `mips-elf', `tx39-elf', `mipsisa32-elf', `mipsisa64-elf',
`mipsel-elf', `mipsisa32el-elf', `mipsisa64el-elf', `mips64vr-elf',
`mips64vrel-elf', `mips64vr4300-elf', `mips64vr4300el-elf',
`mips-sgi-irix5' and `mips-rtems' targets, among others.  This fix makes
section GC usable with the affected targets.

bfd/
* elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Set
`mark' for symbols created from `mips_elf_dynsym_rtproc_names'
list.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2018-04-10 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #40 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Alan Modra :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=18e404c4e2eb15443cc6dda93cbd38bdfeb17667

commit 18e404c4e2eb15443cc6dda93cbd38bdfeb17667
Author: Alan Modra 
Date:   Wed Apr 11 11:10:18 2018 +0930

Silence nds32 pic warnings

Fixes:
FAIL: Build pr22471a.so
FAIL: Build pr22471b.so
FAIL: Build pr22649-1.so
FAIL: Build pr22649-2c.so
FAIL: Build pr22649-2d.so
FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared
library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
FAIL: PR ld/20828 dynamic symbols with section GC (version script)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned shared
library)
FAIL: PR ld/20828 dynamic symbols with section GC (versioned)
FAIL: PR ld/21233 dynamic symbols with section GC (auxiliary shared
library)
FAIL: Build pr22150.so
FAIL: Build shared library for pr14170
FAIL: PR ld/21703 shared
FAIL: Build shared library for broken linker script test
FAIL: Build pr17068.so
FAIL: -Bsymbolic-functions
FAIL: Build pr20995.so
FAIL: Build pr20995-2.so
FAIL: Build pr22374 shared library

* testsuite/ld-elf/shared.exp (AFLAGS_PIC): Add -mpic for nds32.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-10-09 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #39 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9d45a7de8b80336b9965ee99353c34be85b1b98f

commit 9d45a7de8b80336b9965ee99353c34be85b1b98f
Author: H.J. Lu 
Date:   Mon Oct 9 12:45:57 2017 -0700

bfin: Don't create .interp section for info->nointerp

Don't create the .interp section with "ld --no-dynamic-linker".  This
fixed:

FAIL: PR ld/20828 forcibly exported symbol version without section GC
FAIL: PR ld/20828 forcibly exported symbol version with section GC
FAIL: readelf version information

* elf32-bfin.c (bfin_size_dynamic_sections): Don't create the
.interp section with "ld --no-dynamic-linker".

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-04-17 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #38 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e6699019c4f363f804f9646974ab1d5e78785ffc

commit e6699019c4f363f804f9646974ab1d5e78785ffc
Author: H.J. Lu 
Date:   Mon Apr 17 07:47:17 2017 -0700

Put soname in the version definition section

commit 902e9fc76a0ec9f642cefa71ef88cca1c675ad54
Author: Maciej W. Rozycki 
Date:   Tue Feb 21 01:46:42 2017 +

PR ld/20828: Move symbol version processing ahead of GC symbol sweep

breaks version definition with --version-script --soname.  This patch
fixes it by getting soname index before generating the version definition
section.

bfd/

PR ld/21389
* elflink.c (bfd_elf_size_dynamic_sections): Get soname index
before generating the version definition section.

ld/

PR ld/21389
* testsuite/ld-elf/pr21389.map: New file.
* testsuite/ld-elf/pr21389.s: Likewise.
* testsuite/ld-elf/pr21389a.d: Likewise.
* testsuite/ld-elf/pr21389b.d: Likewise.
* testsuite/ld-elf/pr21389c.d: Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-04-05 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #37 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_28-branch branch has been updated by Maciej W. Rozycki
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=beefa9cd657b7187659ba455b704b4be3c28ab17

commit beefa9cd657b7187659ba455b704b4be3c28ab17
Author: Maciej W. Rozycki 
Date:   Mon Mar 27 12:39:07 2017 +0100

PR ld/21233: Avoid sweeping forced-undefined symbols in section GC

Complement commit 902e9fc76a0e ("PR ld/20828: Move symbol version
processing ahead of GC symbol sweep"), commit b531344c34b0 ("PR
ld/20828: Reorder the symbol sweep stage of section GC") and commit
81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced
local with section GC"), and prevent symbols forcibly entered in the
output file with the use of the `--undefined=' or `--require-defined='
linker command line options or the EXTERN linker script command from
being swept in section garbage collection and consequently recorded in
the dynamic symbol table as local entries.  This happens in certain
circumstances, where a symbol reference also exists in one of the static
input files, however only in a section which is garbage-collected and
does not make it to the output file, and the symbol is defined in a
dynamic object present in the link.

For example with the `i386-linux' target and the `pr21233.s' and
`pr21233-l.s' sources, and the `pr21233.ld' linker script included with
this change we get:

$ as -o pr21233-l.o pr21233-l.s
$ ld -shared -T pr21233.ld -o libpr21233.so pr21233-l.o
$ as -o pr21233.o pr21233.s
$ ld --gc-sections -e foo --require-defined=bar -T pr21233.ld -o pr21233
pr21233.o libpr21233.so
$ readelf --dyn-syms pr21233

Symbol table '.dynsym' contains 2 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND
 1:  0 OBJECT  LOCAL  DEFAULT  UND bar
$

which makes the run-time `bar' dependency of the `pr21233' executable
different from its corresponding link-time dependency, i.e. the presence
of `libpr21233.so' and its `bar' symbol is required at the link time,
however at the run time a copy of `libpr21233.so' without `bar' will do.
Similarly with `--undefined=' and EXTERN which do not actually require
the reference to the symbol requested to be satisfied with a definition
at the link time, however once the definition has been pulled at the
link time, so it should at the dynamic load time.

Additionally with the `mips-linux' target we get:

$ ld --gc-sections -e foo --require-defined=bar -T pr21233.ld -o pr21233
pr21233.o libpr21233.so
ld: BFD (GNU Binutils) 2.28.51.20170324 assertion fail
.../bfd/elfxx-mips.c:3861
$

as the target is not prepared to handle such a local dynamic symbol.

With this change in effect we get:

$ readelf --dyn-syms pr21233

Symbol table '.dynsym' contains 2 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND
 1:  0 OBJECT  GLOBAL DEFAULT  UND bar
$

instead, for both targets.

ld/
PR ld/21233
* ldlang.c (insert_undefined): Set `mark' for ELF symbols.

(backported from commit 80070c0d3491347f11283c5791b9dd040fedbd4f)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-04-04 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #36 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=80070c0d3491347f11283c5791b9dd040fedbd4f

commit 80070c0d3491347f11283c5791b9dd040fedbd4f
Author: Maciej W. Rozycki 
Date:   Mon Mar 27 12:39:07 2017 +0100

PR ld/21233: Avoid sweeping forced-undefined symbols in section GC

Complement commit 902e9fc76a0e ("PR ld/20828: Move symbol version
processing ahead of GC symbol sweep"), commit b531344c34b0 ("PR
ld/20828: Reorder the symbol sweep stage of section GC") and commit
81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced
local with section GC"), and prevent symbols forcibly entered in the
output file with the use of the `--undefined=' or `--require-defined='
linker command line options or the EXTERN linker script command from
being swept in section garbage collection and consequently recorded in
the dynamic symbol table as local entries.  This happens in certain
circumstances, where a symbol reference also exists in one of the static
input files, however only in a section which is garbage-collected and
does not make it to the output file, and the symbol is defined in a
dynamic object present in the link.

For example with the `i386-linux' target and the `pr21233.s' and
`pr21233-l.s' sources, and the `pr21233.ld' linker script included with
this change we get:

$ as -o pr21233-l.o pr21233-l.s
$ ld -shared -T pr21233.ld -o libpr21233.so pr21233-l.o
$ as -o pr21233.o pr21233.s
$ ld --gc-sections -e foo --require-defined=bar -T pr21233.ld -o pr21233
pr21233.o libpr21233.so
$ readelf --dyn-syms pr21233

Symbol table '.dynsym' contains 2 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND
 1:  0 OBJECT  LOCAL  DEFAULT  UND bar
$

which makes the run-time `bar' dependency of the `pr21233' executable
different from its corresponding link-time dependency, i.e. the presence
of `libpr21233.so' and its `bar' symbol is required at the link time,
however at the run time a copy of `libpr21233.so' without `bar' will do.
Similarly with `--undefined=' and EXTERN which do not actually require
the reference to the symbol requested to be satisfied with a definition
at the link time, however once the definition has been pulled at the
link time, so it should at the dynamic load time.

Additionally with the `mips-linux' target we get:

$ ld --gc-sections -e foo --require-defined=bar -T pr21233.ld -o pr21233
pr21233.o libpr21233.so
ld: BFD (GNU Binutils) 2.28.51.20170324 assertion fail
.../bfd/elfxx-mips.c:3861
$

as the target is not prepared to handle such a local dynamic symbol.

With this change in effect we get:

$ readelf --dyn-syms pr21233

Symbol table '.dynsym' contains 2 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND
 1:  0 OBJECT  GLOBAL DEFAULT  UND bar
$

instead, for both targets.

ld/
PR ld/21233
* ldlang.c (insert_undefined): Set `mark' for ELF symbols.
* testsuite/ld-elf/pr21233.sd: New test.
* testsuite/ld-elf/pr21233-l.sd: New test.
* testsuite/ld-elf/pr21233.ld: New test linker script.
* testsuite/ld-elf/pr21233-e.ld: New test linker script.
* testsuite/ld-elf/pr21233.s: New test source.
* testsuite/ld-elf/pr21233-l.s: New test source.
* testsuite/ld-elf/shared.exp: Run the new tests.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-02-22 Thread ma...@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

Maciej W. Rozycki  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #35 from Maciej W. Rozycki  ---
Fixed again, hopefully for real this time.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-02-22 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #34 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=902e9fc76a0ec9f642cefa71ef88cca1c675ad54

commit 902e9fc76a0ec9f642cefa71ef88cca1c675ad54
Author: Maciej W. Rozycki 
Date:   Tue Feb 21 01:46:42 2017 +

PR ld/20828: Move symbol version processing ahead of GC symbol sweep

Complement commit b531344c34b0 ("PR ld/20828: Reorder the symbol sweep
stage of section GC") and commit 81ff47b3a546 ("PR ld/20828: Fix linker
script symbols wrongly forced local with section GC") and move symbol
version processing ahead of the symbol sweep stage of section GC, all in
`bfd_elf_size_dynamic_sections', so that version symbols created stay in
the global scope and are not output as local symbols to the dynamic
symbol table in the presence of corresponding symbol definitions pulled
from a DSO involved in a link.

Consolidate the whole of symbol version processing into a single block
from all parts scattered across the function and rearranging the local
variables used as necessary, however leaving the setting of dynamic
entries associated with the DT_VERDEF, DT_VERDEFNUM, DT_VERNEED and
DT_VERNEEDNUM tags and the SEC_EXCLUDE flag for unused `.gnu.version'
section in the original places.

With the rearrangement of code blocks `Elf_Internal_Verneed *t' would
shadow the previous definition of `struct bfd_elf_version_tree *t', so
rename the former variable to `vn'.

bfd/
PR ld/20828
* elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
processing ahead of the call to `elf_gc_sweep_symbol'.

ld/
PR ld/20828
* testsuite/ld-elf/pr20828-d.sd: New test.
* testsuite/ld-elf/pr20828-e.sd: New test.
* testsuite/ld-elf/pr20828-v.od: New test.
* testsuite/ld-elf/pr20828-v.ver: New test version script.
* testsuite/ld-elf/pr20828-v.ld: New test linker script.
* testsuite/ld-elf/pr20828.ld: Add `.gnu.version' and
`.gnu.version_d'.
* testsuite/ld-elf/shared.exp: Run the new tests.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-02-13 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #33 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_28-branch branch has been updated by Maciej W. Rozycki
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e7ec0c47c5500b572b847cddd5b0868ef3784473

commit e7ec0c47c5500b572b847cddd5b0868ef3784473
Author: Maciej W. Rozycki 
Date:   Thu Feb 2 22:05:46 2017 +

MIPS/BFD: Respect the ELF gABI dynamic symbol table sort requirement

Ensure all local symbols precede external symbols in the dynamic symbol
table.

No local symbols are expected to make it to the dynamic symbol table
except for section symbols already taken care of, so this is really a
safeguard only against a potential BFD bug otherwise not so harmful,
which may become a grave one due to a symbol table sorting requirement
violation (see PR ld/20828 for an example).  This means however that no
test suite coverage is possible for this change as code introduced here
is not normally expected to trigger.

Logically split then the part of the dynamic symbol table which is not
global offset table mapped, into a local area at the beginning and an
external area following.  By the time `mips_elf_sort_hash_table' is
called we have the number of local dynamic symbol table entries (section
and non-section) already counted in `local_dynsymcount', so use it to
offset the external area from the beginning.

bfd/
* elfxx-mips.c (mips_elf_hash_sort_data): Add
`max_local_dynindx'.
(mips_elf_sort_hash_table): Handle it.
(mips_elf_sort_hash_table_f) : For forced local
symbols bump up `max_local_dynindx' rather than
`max_non_got_dynindx'.

(cherry picked from commit e17b0c351f0b22fb42edf34e5a6e486d72e9ee05)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-02-02 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #32 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e17b0c351f0b22fb42edf34e5a6e486d72e9ee05

commit e17b0c351f0b22fb42edf34e5a6e486d72e9ee05
Author: Maciej W. Rozycki 
Date:   Thu Feb 2 22:05:46 2017 +

MIPS/BFD: Respect the ELF gABI dynamic symbol table sort requirement

Ensure all local symbols precede external symbols in the dynamic symbol
table.

No local symbols are expected to make it to the dynamic symbol table
except for section symbols already taken care of, so this is really a
safeguard only against a potential BFD bug otherwise not so harmful,
which may become a grave one due to a symbol table sorting requirement
violation (see PR ld/20828 for an example).  This means however that no
test suite coverage is possible for this change as code introduced here
is not normally expected to trigger.

Logically split then the part of the dynamic symbol table which is not
global offset table mapped, into a local area at the beginning and an
external area following.  By the time `mips_elf_sort_hash_table' is
called we have the number of local dynamic symbol table entries (section
and non-section) already counted in `local_dynsymcount', so use it to
offset the external area from the beginning.

bfd/
* elfxx-mips.c (mips_elf_hash_sort_data): Add
`max_local_dynindx'.
(mips_elf_sort_hash_table): Handle it.
(mips_elf_sort_hash_table_f) : For forced local
symbols bump up `max_local_dynindx' rather than
`max_non_got_dynindx'.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-31 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #31 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=15a00b13aedc6300732d0b3b6b9daefa361ced6f

commit 15a00b13aedc6300732d0b3b6b9daefa361ced6f
Author: Maciej W. Rozycki 
Date:   Tue Jan 31 17:59:44 2017 +

PR ld/20828: LD/testsuite: Correct indentation

ld/
PR ld/20828
* testsuite/ld-elf/shared.exp: Correct PR ld/20828 test
indentation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-30 Thread ma...@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

Maciej W. Rozycki  changed:

   What|Removed |Added

 Status|REOPENED|ASSIGNED

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-28 Thread james410 at cowgill dot org.uk
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

James Cowgill  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #30 from James Cowgill  ---
Hi Maciej,

Unfortunately this bug doesn't seem completely fixed. It still affects "symbol
version" symbols (maybe they have a better name?).

See:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844227#260

I can reproduce this if I compile both libstubs.so and liboutput.so from my
original testcase with this version script:

== test.ver ===
TEST { global: a; };

$ gcc -shared -Wl,--version-script=test.ver libstubs.c -o libstubs.so
$ gcc -c stubs.c
$ ld -shared --version-script=test.ver --gc-sections -o liboutput.so stubs.o
libstubs.so

==
$ readelf --dyn-sym libstubs.so 

Symbol table '.dynsym' contains 18 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND 
 1: 056c 0 SECTION LOCAL  DEFAULT   12 
 2: 000107bc 0 NOTYPE  GLOBAL DEFAULT   20 _edata
 3: 0740 0 FUNCGLOBAL DEFAULT   14 _fini
 4: 071036 FUNCGLOBAL DEFAULT   13 alpha
 5: 00010780 0 NOTYPE  GLOBAL DEFAULT   19 _fdata
 6:  0 OBJECT  GLOBAL DEFAULT  ABS TEST
 7: 000107d0 0 NOTYPE  GLOBAL DEFAULT   21 _end
 8: 000107bc 0 NOTYPE  GLOBAL DEFAULT   21 __bss_start
 9: 00018770 0 SECTION GLOBAL DEFAULT  ABS _gp_disp
10: 05b0 0 NOTYPE  GLOBAL DEFAULT   13 _ftext
11: 000107bc 0 NOTYPE  GLOBAL DEFAULT   21 _fbss
12: 056c 0 FUNCGLOBAL DEFAULT   12 _init
13:  0 NOTYPE  WEAK   DEFAULT  UND _ITM_registerTMCloneTable
14:  0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
15:  0 FUNCWEAK   DEFAULT  UND __gmon_start__
16:  0 NOTYPE  WEAK   DEFAULT  UND _ITM_deregisterTMCloneTab
17:  0 FUNCWEAK   DEFAULT  UND __cxa_finalize@GLIBC_2.2 (3)

$ readelf --dyn-sym liboutput.so 

Symbol table '.dynsym' contains 11 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND 
 1: 0340 0 SECTION LOCAL  DEFAULT8 
 2: 00010390 0 NOTYPE  GLOBAL DEFAULT9 _fdata
 3: 034036 FUNCGLOBAL DEFAULT8 psi
 4:  0 OBJECT  LOCAL  DEFAULT  ABS TEST
 5: 0340 0 NOTYPE  GLOBAL DEFAULT8 _ftext
 6: 00010398 0 NOTYPE  GLOBAL DEFAULT9 __bss_start
 7: 036436 FUNCGLOBAL DEFAULT8 omega
 8: 00010398 0 NOTYPE  GLOBAL DEFAULT9 _edata
 9: 00010398 0 NOTYPE  GLOBAL DEFAULT9 _end
10: 00010398 0 NOTYPE  GLOBAL DEFAULT9 _fbss

As you can see, there is a misplaced LOCAL symbol in liboutput.so.

Thanks,
James

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-24 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #29 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_28-branch branch has been updated by Maciej W. Rozycki
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8cf12fd327278b6e5edd90f162dc257656603f30

commit 8cf12fd327278b6e5edd90f162dc257656603f30
Author: Maciej W. Rozycki 
Date:   Mon Jan 23 11:37:19 2017 +

Solaris2/LD: Fix anonymous version script acceptance bug

Correct a bug in Solaris 2 linker emulation code triggered by a test
introduced with commit 81ff47b3a546 ("PR ld/20828: Fix linker script
symbols wrongly forced local with section GC") and only create implicit
version nodes if versioning is actually introduced with a version script
(or VERSION command) rather than only global vs local symbol visibility
selected, fixing an:

ld: anonymous version tag cannot be combined with other version tags

linker error produced whenever a version script (or VERSION command) is
used that does not assign symbol versions, such as:

{ global: foo; bar; local: *; };

and consequently removing a:

FAIL: PR ld/20828 dynamic symbols with section GC (version script)

test suite failure with the `x86_64-solaris2' target.

ld/
* emultempl/solaris2.em (elf_solaris2_before_allocation): Do not
add implicit version nodes if an anonymous version tag is being
used.

(cherry picked from commit 1a792e1c00e07a1e644145a9f71446cf2e75e9ab)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-24 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #27 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1a792e1c00e07a1e644145a9f71446cf2e75e9ab

commit 1a792e1c00e07a1e644145a9f71446cf2e75e9ab
Author: Maciej W. Rozycki 
Date:   Mon Jan 23 11:37:19 2017 +

Solaris2/LD: Fix anonymous version script acceptance bug

Correct a bug in Solaris 2 linker emulation code triggered by a test
introduced with commit 81ff47b3a546 ("PR ld/20828: Fix linker script
symbols wrongly forced local with section GC") and only create implicit
version nodes if versioning is actually introduced with a version script
(or VERSION command) rather than only global vs local symbol visibility
selected, fixing an:

ld: anonymous version tag cannot be combined with other version tags

linker error produced whenever a version script (or VERSION command) is
used that does not assign symbol versions, such as:

{ global: foo; bar; local: *; };

and consequently removing a:

FAIL: PR ld/20828 dynamic symbols with section GC (version script)

test suite failure with the `x86_64-solaris2' target.

ld/
* emultempl/solaris2.em (elf_solaris2_before_allocation): Do not
add implicit version nodes if an anonymous version tag is being
used.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-23 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #22 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fda46c417ff8324960ca305141df5fc6c2f580af

commit fda46c417ff8324960ca305141df5fc6c2f580af
Author: Maciej W. Rozycki 
Date:   Mon Jan 23 11:19:46 2017 +

PR ld/20828: Remove leading `_' from symbols used in tests

Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and remove the leading underscore
from `_fdata' and `_edata' symbols used in tests, fixing a:

FAIL: PR ld/20828 dynamic symbols with section GC (version script)

failure with targets such as: `bfin-elf', `bfin-uclinux', `metag-elf',
`metag-linux' `mn10300-elf', `sh-elf', `sh64-elf', and possibly other
ones, that have `_' set (with `elf_symbol_leading_char') as the leading
character for symbols.  As from commit 93252b1cf41a ("bfd/ld: handle ABI
prefixes in version scripts") these targets strip the leading underscore
before applying version script rules, because the (default) syntax for
symbol names is that of the C language rather than their low-level
symbol table encoding.

ld/
PR ld/20828
* testsuite/ld-elf/pr20828.ld: Rename `_fdata' and `_edata' to
`fdata' and `edata' respectively.
* testsuite/ld-elf/pr20828.ver: Adjust accordingly.
* testsuite/ld-elf/pr20828-a.sd: Likewise.
* testsuite/ld-elf/pr20828-b.sd: Likewise.
* testsuite/ld-elf/pr20828-c.sd: Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-23 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #26 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_28-branch branch has been updated by Maciej W. Rozycki
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f1e1be692fded333465d71ace0347db736ecc441

commit f1e1be692fded333465d71ace0347db736ecc441
Author: Maciej W. Rozycki 
Date:   Mon Jan 23 11:21:19 2017 +

PR ld/20828: Work around RISC-V failures

Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and add `.plt' to the list of
output sections created, fixing:

FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared
library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
FAIL: PR ld/20828 dynamic symbols with section GC (version script)

failures with `riscv32-elf', `riscv32-linux', `riscv64-elf' and
`riscv64-linux' targets caused by LD crashing in the absence of such a
section.

ld/
PR ld/20828
* testsuite/ld-elf/pr20828.ld: Add `.plt'.

(cherry picked from commit 1e5f45bb15d287ed763b7b638254424149040f7a)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-23 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #25 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_28-branch branch has been updated by Maciej W. Rozycki
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b70d100fc1c5a130c3fe9387be83b7927e2025fb

commit b70d100fc1c5a130c3fe9387be83b7927e2025fb
Author: Maciej W. Rozycki 
Date:   Mon Jan 23 11:19:46 2017 +

PR ld/20828: Remove leading `_' from symbols used in tests

Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and remove the leading underscore
from `_fdata' and `_edata' symbols used in tests, fixing a:

FAIL: PR ld/20828 dynamic symbols with section GC (version script)

failure with targets such as: `bfin-elf', `bfin-uclinux', `metag-elf',
`metag-linux' `mn10300-elf', `sh-elf', `sh64-elf', and possibly other
ones, that have `_' set (with `elf_symbol_leading_char') as the leading
character for symbols.  As from commit 93252b1cf41a ("bfd/ld: handle ABI
prefixes in version scripts") these targets strip the leading underscore
before applying version script rules, because the (default) syntax for
symbol names is that of the C language rather than their low-level
symbol table encoding.

ld/
PR ld/20828
* testsuite/ld-elf/pr20828.ld: Rename `_fdata' and `_edata' to
`fdata' and `edata' respectively.
* testsuite/ld-elf/pr20828.ver: Adjust accordingly.
* testsuite/ld-elf/pr20828-a.sd: Likewise.
* testsuite/ld-elf/pr20828-b.sd: Likewise.
* testsuite/ld-elf/pr20828-c.sd: Likewise.

(cherry picked from commit fda46c417ff8324960ca305141df5fc6c2f580af)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-23 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #24 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_28-branch branch has been updated by Maciej W. Rozycki
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7d9468120fceed20240511404e6d9498e68f3dc6

commit 7d9468120fceed20240511404e6d9498e68f3dc6
Author: Maciej W. Rozycki 
Date:   Mon Jan 23 11:18:33 2017 +

PR ld/20828: Relax symbol ordering in tests

Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and make tests check for the
presence of global `_fdata' and `_edata' symbols separately, removing
any dependency on symbol table ordering for tests to succeed and
removing:

FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared
library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)

failures with the `x86_64-solaris2' target, which has additional
intervening entries:

Symbol table '.dynsym' contains 6 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND
 1:  0 NOTYPE  GLOBAL DEFAULT1 _fdata
 2:  0 OBJECT  GLOBAL DEFAULT1 _DYNAMIC
 3:  0 OBJECT  GLOBAL DEFAULT  ABS
_PROCEDURE_LINKAGE_TABLE_
 4:  0 NOTYPE  GLOBAL DEFAULT1 _edata
 5: 01b8 0 OBJECT  GLOBAL DEFAULT4
_GLOBAL_OFFSET_TABLE_

Rename dump pattern files accordingly for consistency.

ld/
PR ld/20828
* testsuite/ld-elf/pr20828-1.sd: Remove test.
* testsuite/ld-elf/pr20828-a.sd: New test.
* testsuite/ld-elf/pr20828-2a.sd: Rename test to...
* testsuite/ld-elf/pr20828-b.sd: ... this.
* testsuite/ld-elf/pr20828-2b.sd: Rename test to...
* testsuite/ld-elf/pr20828-c.sd: ... this.
* testsuite/ld-elf/shared.exp: Adjust accordingly.

(cherry picked from commit adcbdc63e5ccf663dacc8493cec63a95b653285e)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-23 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #22 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fda46c417ff8324960ca305141df5fc6c2f580af

commit fda46c417ff8324960ca305141df5fc6c2f580af
Author: Maciej W. Rozycki 
Date:   Mon Jan 23 11:19:46 2017 +

PR ld/20828: Remove leading `_' from symbols used in tests

Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and remove the leading underscore
from `_fdata' and `_edata' symbols used in tests, fixing a:

FAIL: PR ld/20828 dynamic symbols with section GC (version script)

failure with targets such as: `bfin-elf', `bfin-uclinux', `metag-elf',
`metag-linux' `mn10300-elf', `sh-elf', `sh64-elf', and possibly other
ones, that have `_' set (with `elf_symbol_leading_char') as the leading
character for symbols.  As from commit 93252b1cf41a ("bfd/ld: handle ABI
prefixes in version scripts") these targets strip the leading underscore
before applying version script rules, because the (default) syntax for
symbol names is that of the C language rather than their low-level
symbol table encoding.

ld/
PR ld/20828
* testsuite/ld-elf/pr20828.ld: Rename `_fdata' and `_edata' to
`fdata' and `edata' respectively.
* testsuite/ld-elf/pr20828.ver: Adjust accordingly.
* testsuite/ld-elf/pr20828-a.sd: Likewise.
* testsuite/ld-elf/pr20828-b.sd: Likewise.
* testsuite/ld-elf/pr20828-c.sd: Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-23 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #23 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1e5f45bb15d287ed763b7b638254424149040f7a

commit 1e5f45bb15d287ed763b7b638254424149040f7a
Author: Maciej W. Rozycki 
Date:   Mon Jan 23 11:21:19 2017 +

PR ld/20828: Work around RISC-V failures

Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and add `.plt' to the list of
output sections created, fixing:

FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared
library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)
FAIL: PR ld/20828 dynamic symbols with section GC (version script)

failures with `riscv32-elf', `riscv32-linux', `riscv64-elf' and
`riscv64-linux' targets caused by LD crashing in the absence of such a
section.

ld/
PR ld/20828
* testsuite/ld-elf/pr20828.ld: Add `.plt'.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-23 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #21 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=adcbdc63e5ccf663dacc8493cec63a95b653285e

commit adcbdc63e5ccf663dacc8493cec63a95b653285e
Author: Maciej W. Rozycki 
Date:   Mon Jan 23 11:18:33 2017 +

PR ld/20828: Relax symbol ordering in tests

Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and make tests check for the
presence of global `_fdata' and `_edata' symbols separately, removing
any dependency on symbol table ordering for tests to succeed and
removing:

FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared
library)
FAIL: PR ld/20828 dynamic symbols with section GC (plain)

failures with the `x86_64-solaris2' target, which has additional
intervening entries:

Symbol table '.dynsym' contains 6 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND
 1:  0 NOTYPE  GLOBAL DEFAULT1 _fdata
 2:  0 OBJECT  GLOBAL DEFAULT1 _DYNAMIC
 3:  0 OBJECT  GLOBAL DEFAULT  ABS
_PROCEDURE_LINKAGE_TABLE_
 4:  0 NOTYPE  GLOBAL DEFAULT1 _edata
 5: 01b8 0 OBJECT  GLOBAL DEFAULT4
_GLOBAL_OFFSET_TABLE_

Rename dump pattern files accordingly for consistency.

ld/
PR ld/20828
* testsuite/ld-elf/pr20828-1.sd: Remove test.
* testsuite/ld-elf/pr20828-a.sd: New test.
* testsuite/ld-elf/pr20828-2a.sd: Rename test to...
* testsuite/ld-elf/pr20828-b.sd: ... this.
* testsuite/ld-elf/pr20828-2b.sd: Rename test to...
* testsuite/ld-elf/pr20828-c.sd: ... this.
* testsuite/ld-elf/shared.exp: Adjust accordingly.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


Re: [Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-20 Thread Maciej W. Rozycki
On Thu, 19 Jan 2017, Nick Clifton wrote:

> Checking Binutils in: bfin-elf ... LD REGRESSION: PR ld/20828 dynamic symbols 
> with 

 As noted before, `_edata' is removed with `--gc-sections' and 
`--version-script' combined, where it is supposed to be exported.  This is 
regardless of the presence of `libpr20828.so' in the link, so it does not 
seem related to PR ld/20828 (same with `bfin-uclinux', so this is a 
genuine backend bug).

> Checking Binutils in: riscv32-elf ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with 

 LD segfaults with the initial `libpr20828.so' link (same with 
`riscv32-linux' BTW), so this is not related to PR ld/20828.  
Consequently all the subsequent dependent tests fail.

 It may be something missing from the linker script used, which is 
required by this port, but then LD should complain rather than crash (ISTR 
`aarch64' and `arm' ports segfaulting too if `.got' and/or `.got.plt' 
sections were discarded from output; this may be something worth looking 
into and handling gracefully as well).

> Checking Binutils in: metag-elf ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with

 Same as with `bfin-elf' (and likewise `metag-linux').

> Checking Binutils in: riscv64-elf ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with

 Same as with `riscv32-elf' (and likewise `riscv64-linux').

> Checking Binutils in: x86_64-solaris2 ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with

 There are two issues here -- one is trivial with `libpr20828.so' having 
extra symbols between `_fdata' and `_edata':

Symbol table '.dynsym' contains 6 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND
 1:  0 NOTYPE  GLOBAL DEFAULT1 _fdata
 2:  0 OBJECT  GLOBAL DEFAULT1 _DYNAMIC
 3:  0 OBJECT  GLOBAL DEFAULT  ABS 
_PROCEDURE_LINKAGE_TABLE_
 4:  0 NOTYPE  GLOBAL DEFAULT1 _edata
 5: 01b8 0 OBJECT  GLOBAL DEFAULT4 _GLOBAL_OFFSET_TABLE_

so this will be a straightforward dump pattern fix.

 The other is tricky -- the sole version script used is as follows:

{ global: _edata; local: *; };

and yet LD complains:

ld: anonymous version tag cannot be combined with other version tags

(so where's the non-anonymous version tag?).  I'll look into it.

> Checking Binutils in: mn10300-elf ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with

 Same as with `bfin-elf'.  I have checked `mn10300-linux' too, but all 
tests fail with:

Assembler messages:
Fatal error: selected target format 'elf32-am33lin' unknown

> Checking Binutils in: score-elf ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with

 As noted before, `_fdata' is exported with `--gc-sections' and 
`--version-script' combined, where it is supposed to be removed.  This 
only happens in the presence of `libpr20828.so' in the link, so it may be 
related to PR ld/20828.  I'll have a look into it.
 
> Checking Binutils in: sh-elf ... LD REGRESSION: PR ld/20828 dynamic symbols 
> with

 Same as with `bfin-elf' (`sh-linux' is fine).

 I'll see if I can figure out easily what is going on with `bfin-elf' 
etc., but I am not going to dive into generic port breakage and I do 
encourage port maintainers to verify their port instead.

  Maciej

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


Re: [Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-19 Thread Maciej W. Rozycki
Hi Nick,

> Unfortunately the new test fails for some targets:
> 
> Checking Binutils in: bfin-elf ... LD REGRESSION: PR ld/20828 dynamic symbols 
> with 
> Checking Binutils in: riscv32-elf ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with 
> Checking Binutils in: metag-elf ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with
> Checking Binutils in: riscv64-elf ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with
> Checking Binutils in: x86_64-solaris2 ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with
> Checking Binutils in: mn10300-elf ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with
> Checking Binutils in: score-elf ... LD REGRESSION: PR ld/20828 dynamic 
> symbols with
> Checking Binutils in: sh-elf ... LD REGRESSION: PR ld/20828 dynamic symbols 
> with
>  
> Could you have a look into these please ?

 See my original submission at:



for the discussion of `bfin-elf', `mn10300-elf', `score-elf' and 
`sh64-elf' failures; I have notified the respective port maintainers too, 
so that they can individually decide if they want to have their target 
fixed now, KFAILed with the intent to fix later or excluded in 
`check_shared_lib_support' (I'd rather not have them papered over blindly 
with XFAIL).  I suspect the remaining bare-metal failures fall into this 
class too, although I can double-check it if you like -- this is the first 
linker test to provide some sort of generic version script coverage it 
would seem.

 The `x86_64-solaris2' failure is worrisome, as I'd certainly expect this 
target to support shared libraries, so I'll see what is going on there.

 Shall I add these of your listed targets that I do not have covered right 
now to my regular verification tests?

 NB in the course of my submission referred it has turned out some of the 
listed maintainer's addresses bounce; these are:

  SCOREMei Ligang 
  BFIN Bernd Schmidt 

Bernd is at RedHat these days; no idea about Mei.  Also Eric's entry:

  MN10300  Eric Christopher 

is obsolete (same with his MIPS entry).  He's been most recently seen 
@gmail.com, although it has been unclear to me if he intends to keep these 
maintainer's posts.

  Maciej

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


Re: [Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-19 Thread Nick Clifton
Hi Maciej,

> Fixed as per the automatic commit messages.

Unfortunately the new test fails for some targets:

Checking Binutils in: bfin-elf ... LD REGRESSION: PR ld/20828 dynamic symbols 
with 
Checking Binutils in: riscv32-elf ... LD REGRESSION: PR ld/20828 dynamic 
symbols with 
Checking Binutils in: metag-elf ... LD REGRESSION: PR ld/20828 dynamic symbols 
with
Checking Binutils in: riscv64-elf ... LD REGRESSION: PR ld/20828 dynamic 
symbols with
Checking Binutils in: x86_64-solaris2 ... LD REGRESSION: PR ld/20828 dynamic 
symbols with
Checking Binutils in: mn10300-elf ... LD REGRESSION: PR ld/20828 dynamic 
symbols with
Checking Binutils in: score-elf ... LD REGRESSION: PR ld/20828 dynamic symbols 
with
Checking Binutils in: sh-elf ... LD REGRESSION: PR ld/20828 dynamic symbols with
 
Could you have a look into these please ?

Cheers
  Nick


___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-18 Thread ma...@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

Maciej W. Rozycki  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #20 from Maciej W. Rozycki  ---
Fixed as per the automatic commit messages.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-18 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #19 from cvs-commit at gcc dot gnu.org  ---
The binutils-2_28-branch branch has been updated by Maciej W. Rozycki
:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4030096d6a689125c026ce1e6300717c2050d105

commit 4030096d6a689125c026ce1e6300717c2050d105
Author: Maciej W. Rozycki 
Date:   Mon Jan 16 22:10:57 2017 +

PR ld/20828: Fix linker script symbols wrongly forced local with section GC

Fix a generic ELF linker regression introduced with a chain of changes
made to unused input section garbage collection:

- commit 1a766c6843ce ("Also hide symbols without PLT nor GOT
  references."),
  ,

- commit 1d5316ab67e1 ("PR ld/13177: garbage collector retains zombie
  references to external libraries"),
  ,

- commit 6673f753c019 ("Fix PR 12772, garbage collection of dynamic
  syms"), ,

causing the garbage collection of unused symbols present in a DSO
involved in a link to make identically named symbols ordinarily defined
(i.e. not hidden or PROVIDEd) by a linker script local, even though the
latter symbols are supposed to be global as if no DSO defined them as
well.

This is because linker script assignments are processed very late as
`lang_process' proceeds, down in the call to `ldemul_before_allocation',
which is made after the call to `lang_gc_sections' to do input section
garbage collecting.  Consequently if unused, then any such DSO-defined
symbol has already been garbage-collected and internally marked local.
It would ordinarily be removed from dynamic symbol table output, however
a linker script assignment correctly replaces its original definition
with the new one and enters it into the dynamic symbol table produced as
it is supposed to be exported.  The original local marking is however
retained making the symbol local in the dynamic symbol table and
therefore not available externally.  This also causes a sorting problem
with the MIPS target, which does not expect non-section local dynamic
symbols to be output and produces an invalid binary.

Fix the problem then, by removing the `forced_local' marking for the
offending case and add suitable test cases.  First to verify that unused
symbols ordinarily defined with linker script assignments remain
exported in the context of input section garbage collection whether or
not a DSO defining identically named symbols is present in the link.
Second that a linker version script still correctly retains or removes
such symbols as requested.

bfd/
PR ld/20828
* elflink.c (bfd_elf_record_link_assignment): Clear any
`forced_local' marking for DSO symbols that are not being
provided.

ld/
PR ld/20828
* testsuite/ld-elf/pr20828-1.sd: New test.
* testsuite/ld-elf/pr20828-2a.sd: New test.
* testsuite/ld-elf/pr20828-2b.sd: New test.
* testsuite/ld-elf/pr20828.ld: New test linker script.
* testsuite/ld-elf/pr20828.ver: New test version script.
* testsuite/ld-elf/pr20828.s: New test source.
* testsuite/ld-elf/shared.exp: Run the new test.

(cherry picked from commit 81ff47b3a54633819fac4d973e34f1ff0c65606e)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-18 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

--- Comment #18 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Maciej W. Rozycki :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=81ff47b3a54633819fac4d973e34f1ff0c65606e

commit 81ff47b3a54633819fac4d973e34f1ff0c65606e
Author: Maciej W. Rozycki 
Date:   Mon Jan 16 22:10:57 2017 +

PR ld/20828: Fix linker script symbols wrongly forced local with section GC

Fix a generic ELF linker regression introduced with a chain of changes
made to unused input section garbage collection:

- commit 1a766c6843ce ("Also hide symbols without PLT nor GOT
  references."),
  ,

- commit 1d5316ab67e1 ("PR ld/13177: garbage collector retains zombie
  references to external libraries"),
  ,

- commit 6673f753c019 ("Fix PR 12772, garbage collection of dynamic
  syms"), ,

causing the garbage collection of unused symbols present in a DSO
involved in a link to make identically named symbols ordinarily defined
(i.e. not hidden or PROVIDEd) by a linker script local, even though the
latter symbols are supposed to be global as if no DSO defined them as
well.

This is because linker script assignments are processed very late as
`lang_process' proceeds, down in the call to `ldemul_before_allocation',
which is made after the call to `lang_gc_sections' to do input section
garbage collecting.  Consequently if unused, then any such DSO-defined
symbol has already been garbage-collected and internally marked local.
It would ordinarily be removed from dynamic symbol table output, however
a linker script assignment correctly replaces its original definition
with the new one and enters it into the dynamic symbol table produced as
it is supposed to be exported.  The original local marking is however
retained making the symbol local in the dynamic symbol table and
therefore not available externally.  This also causes a sorting problem
with the MIPS target, which does not expect non-section local dynamic
symbols to be output and produces an invalid binary.

Fix the problem then, by removing the `forced_local' marking for the
offending case and add suitable test cases.  First to verify that unused
symbols ordinarily defined with linker script assignments remain
exported in the context of input section garbage collection whether or
not a DSO defining identically named symbols is present in the link.
Second that a linker version script still correctly retains or removes
such symbols as requested.

bfd/
PR ld/20828
* elflink.c (bfd_elf_record_link_assignment): Clear any
`forced_local' marking for DSO symbols that are not being
provided.

ld/
PR ld/20828
* testsuite/ld-elf/pr20828-1.sd: New test.
* testsuite/ld-elf/pr20828-2a.sd: New test.
* testsuite/ld-elf/pr20828-2b.sd: New test.
* testsuite/ld-elf/pr20828.ld: New test linker script.
* testsuite/ld-elf/pr20828.ver: New test version script.
* testsuite/ld-elf/pr20828.s: New test source.
* testsuite/ld-elf/shared.exp: Run the new test.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/20828] GC-ed DSO symbols make corresponding symbols defined by a linker script local

2017-01-16 Thread ma...@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=20828

Maciej W. Rozycki  changed:

   What|Removed |Added

Summary|[MIPS] produces invalid |GC-ed DSO symbols make
   |dynamic symbol table when   |corresponding symbols
   |--gc-sections is used since |defined by a linker script
   |PR ld/13177 fix |local

--- Comment #17 from Maciej W. Rozycki  ---
I've got down to the bottom of this issue now and as it turns out our
initial understanding was completely wrong.

The real issue is the presence of unused (and GC-ed) symbols in a DSO
used in a link makes identically named symbols ordinarily defined (not
hidden or PROVIDEd) by a linker script local, even though the latter
symbols are supposed to be global as if no DSO defined them as well.  So
rather than removing the local entries made in the dynamic symbol table
produced we actually need to make them global.  See
 for the full
analysis, proposed patch, test cases and results.

The issue applies to our all ELF targets with DSO support and the outcome
just happens to hurt MIPS binaries in the most spectacular way, due to
this target psABI's peculiarity and our handling of it, by making any
affected binaries produced invalid, in addition to being incorrect as
with the remaining ELF targets.

Regardless I have made a MIPS dynamic symbol table sorting update in case
we have a valid reason sometime to have (non-section) local entries
there.  This turned out simpler than I had thought as by the time
`mips_elf_sort_hash_table' is called all the necessary information has
already been gathered by the generic ELF linker and the MIPS backend, as
applicable.  So all that has to be done is using it properly to assign
final indices.

With the fix for this issue in place the problematic case of dynamic
symbol table sorting cannot be triggered however, so no test case is
possible, and I will be only pushing the sorting change, along with a
couple of preparatory clean-ups to code affected, to our master branch,
with no backport to 2.28 planned.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils