aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-11-12 17:03:50 -0800
committerH.J. Lu <hjl.tools@gmail.com>2017-11-12 17:04:03 -0800
commitf882209d9aa5b68d68c45c5849e129ffc228749c (patch)
treebcb7059f22ae6ff16f204c2f10fe7ecf2826fa78 /bfd
parent53892e6d2395b818554b825cabf6129fed7e2aae (diff)
downloadgdb-f882209d9aa5b68d68c45c5849e129ffc228749c.zip
gdb-f882209d9aa5b68d68c45c5849e129ffc228749c.tar.gz
gdb-f882209d9aa5b68d68c45c5849e129ffc228749c.tar.bz2
ld: Remove PF_X from PT_PHDR segment
It was reasonable to mark PT_PHDR segment with PF_X for compatibility with UnixWare and Solaris linkers 20 years ago. But it is inappropriate today when the primary OS of GNU ld is Linux. This patch removes PF_X from PT_PHDR segment as gold does. Tested natively on Linux/x86 as well as crosss-binutils for alpha-linux, ia64-linux, powerpc64-linux, powerpc-linux, s390-linux, s390x-linux, sparc64-linux and sparc-linux. bfd/ PR ld/22423 * elf.c (_bfd_elf_map_sections_to_segments): Remove PF_X from PT_PHDR segment. ld/ PR ld/22423 * testsuite/ld-alpha/tlsbin.rd: Replace "R E " with "R +" for PT_PHDR segment. * testsuite/ld-alpha/tlsbinr.rd: Likewise. * testsuite/ld-ia64/tlsbin.rd: Likewise. * testsuite/ld-powerpc/tlsexe.r: Likewise. * testsuite/ld-powerpc/tlsexe32.r: Likewise. * testsuite/ld-powerpc/tlsexetoc.r: Likewise. * testsuite/ld-s390/tlsbin.rd: Likewise. * testsuite/ld-s390/tlsbin_64.rd: Likewise. * testsuite/ld-sparc/tlssunbin32.rd: Likewise. * testsuite/ld-sparc/tlssunbin64.rd: Likewise. * testsuite/ld-elf/pr22423.d: New test.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf.c3
2 files changed, 7 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 989149a..d1b995a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/22423
+ * elf.c (_bfd_elf_map_sections_to_segments): Remove PF_X from
+ PT_PHDR segment.
+
2017-11-12 Alan Modra <amodra@gmail.com>
* elflink.c (elf_link_add_object_symbols): Ignore anything but
diff --git a/bfd/elf.c b/bfd/elf.c
index 9cecb24..694e435 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -4610,8 +4610,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
goto error_return;
m->next = NULL;
m->p_type = PT_PHDR;
- /* FIXME: UnixWare and Solaris set PF_X, Irix 5 does not. */
- m->p_flags = PF_R | PF_X;
+ m->p_flags = PF_R;
m->p_flags_valid = 1;
m->includes_phdrs = 1;
linker_created_pt_phdr_segment = TRUE;