x86: Suggest -fPIE when not building shared object
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 17 Apr 2019 17:22:19 +0000 (10:22 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 17 Apr 2019 17:25:28 +0000 (10:25 -0700)
commit9a7f0679fd3b9815b8eb938bfdad3934b8435419
tree4b1d7e65292f9e4e1fa93e26ede4e885ddf553c2
parent4e84a8f8bbeab52fa7048873655e582ceb92534d
x86: Suggest -fPIE when not building shared object

When PIC is needed, linker should suggest -fPIE, instead of -fPIC, when
not building shared object.

bfd/

* elf64-x86-64.c (elf_x86_64_need_pic): Suggest -fPIE when not
building shared object.
* elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Likewise.

ld/

* testsuite/ld-i386/i386.exp: Run pr18801a and pr18801b instead
of pr18801.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr18801.d: Removed.
* testsuite/ld-x86-64/pr18801.d: Likewise.
* testsuite/ld-i386/pr18801a.d: New file.
* testsuite/ld-i386/pr18801b.d: Likewise.
* testsuite/ld-x86-64/pr18801a.d: Likewise.
* testsuite/ld-x86-64/pr18801b.d: Likewise.
* testsuite/ld-x86-64/pie2.d: Suggest -fPIE instead of -fPIC.
* testsuite/ld-x86-64/pie2.d: Likewise.
* testsuite/ld-x86-64/pr19719.d: Likewise.
* testsuite/ld-x86-64/pr19807-2a.d: Likewise.
* testsuite/ld-x86-64/pr19969.d: Likewise.
* testsuite/ld-x86-64/pr21997-1a.err: Likewise.
* testsuite/ld-x86-64/pr21997-1b.err: Likewise.
* testsuite/ld-x86-64/pr22001-1a.err: Likewise.
* testsuite/ld-x86-64/pr22001-1b.err: Likewise.
* testsuite/ld-x86-64/pr22791-1.err: Likewise.
19 files changed:
bfd/ChangeLog
bfd/elf64-x86-64.c
bfd/elfxx-x86.c
ld/ChangeLog
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/pr18801a.d [moved from ld/testsuite/ld-i386/pr18801.d with 74% similarity]
ld/testsuite/ld-i386/pr18801b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pie2.d
ld/testsuite/ld-x86-64/pr18801a.d [moved from ld/testsuite/ld-x86-64/pr18801.d with 74% similarity]
ld/testsuite/ld-x86-64/pr18801b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19719.d
ld/testsuite/ld-x86-64/pr19807-2a.d
ld/testsuite/ld-x86-64/pr19969.d
ld/testsuite/ld-x86-64/pr21997-1a.err
ld/testsuite/ld-x86-64/pr21997-1b.err
ld/testsuite/ld-x86-64/pr22001-1a.err
ld/testsuite/ld-x86-64/pr22001-1b.err
ld/testsuite/ld-x86-64/pr22791-1.err
ld/testsuite/ld-x86-64/x86-64.exp