PR26580, Size and alignment of commons vs as-needed shared lib
authorAlan Modra <amodra@gmail.com>
Tue, 8 Sep 2020 03:32:31 +0000 (13:02 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 8 Sep 2020 13:00:38 +0000 (22:30 +0930)
commit7ba115508aa02ffbb01a09613b5dffdd0c6563e3
tree9a0251fdea1dd80de80d22b01ca2172b8fab0b71
parent7ade7fba756326c5f35f53a8e2d46443c6bab73f
PR26580, Size and alignment of commons vs as-needed shared lib

Two pieces to this puzzle:
1) Revert HJ's fix for PR13250 so that size and alignment isn't
   sticky, instead attack the real underlying problem that
   _bfd_generic_link_add_one_symbol does the wrong thing in making a
   common section in a shared library bfd.
2) Save and restore common u.c.p fields, which hold the section and
   alignment.

A better fix for (2) would be to throw away all of that horrible code
saving and restoring the hash table when loading as-needed library
symbols, and instead do a scan over as-needed library symbols before
adding anything.

bfd/
PR 13250
PR 26580
* elflink.c (_bfd_elf_merge_symbol): Make "override" a bfd**.
Return oldbfd in override when old common should override new
common.
(_bfd_elf_add_default_symbol): Adjust to suit.
(elf_link_add_object_symbols): Likewise.  Pass "override" to
_bfd_generic_link_add_one_symbol.  Save and restore common u.c.p
field for --as-needed shared libraries.  Revert pr13250 changes.
ld/
* testsuite/ld-elf/pr26580-a.s,
* testsuite/ld-elf/pr26580-b.s,
* testsuite/ld-elf/pr26580-1.sd,
* testsuite/ld-elf/pr26580-2.sd: New tests
* testsuite/ld-elf/comm-data.exp: Run new tests.
* testsuite/ld-elf/pr26580-a.c,
* testsuite/ld-elf/pr26580-b.c,
* testsuite/ld-elf/pr26580-3.out,
* testsuite/ld-elf/pr26580-4.out: New tests.
* testsuite/ld-elf/shared.exp: Run new tests.
13 files changed:
bfd/ChangeLog
bfd/elflink.c
ld/ChangeLog
ld/testsuite/ld-elf/comm-data.exp
ld/testsuite/ld-elf/pr26580-1.sd [new file with mode: 0644]
ld/testsuite/ld-elf/pr26580-2.sd [new file with mode: 0644]
ld/testsuite/ld-elf/pr26580-3.out [new file with mode: 0644]
ld/testsuite/ld-elf/pr26580-4.out [new file with mode: 0644]
ld/testsuite/ld-elf/pr26580-a.c [new file with mode: 0644]
ld/testsuite/ld-elf/pr26580-a.s [new file with mode: 0644]
ld/testsuite/ld-elf/pr26580-b.c [new file with mode: 0644]
ld/testsuite/ld-elf/pr26580-b.s [new file with mode: 0644]
ld/testsuite/ld-elf/shared.exp
This page took 0.027274 seconds and 4 git commands to generate.