elf: Copy elf_gnu_osabi_retain only for relocatable link
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 18 Dec 2020 12:24:26 +0000 (04:24 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 18 Dec 2020 12:24:36 +0000 (04:24 -0800)
commit04f8967487515179cc6dfc7c828f77eeb75c08d3
treee94cbcef29d4c243b02807377d5f9a98f2c3808c
parent3fafa2e26ed651e3d3a50193b5bbf8f55779c7aa
elf: Copy elf_gnu_osabi_retain only for relocatable link

Copy elf_gnu_osabi_retain from input only for relocatable link since
SHF_GNU_RETAIN has no impact on non-relocatable outputs.

bfd/

PR ld/27091
* elflink.c (elf_link_input_bfd): Copy elf_gnu_osabi_retain
from input only for relocatable link.

ld/

PR ld/27091
* testsuite/ld-elf/retain7.s: New file.
* testsuite/ld-elf/retain7a.d: Likewise.
* testsuite/ld-elf/retain7b.d: Likewise.
bfd/ChangeLog
bfd/elflink.c
ld/ChangeLog
ld/testsuite/ld-elf/retain7.s [new file with mode: 0644]
ld/testsuite/ld-elf/retain7a.d [new file with mode: 0644]
ld/testsuite/ld-elf/retain7b.d [new file with mode: 0644]