https://sourceware.org/bugzilla/show_bug.cgi?id=22423
Bug ID: 22423 Summary: PT_PHDR segment is marked with PF_X Product: binutils Version: 2.30 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: hjl.tools at gmail dot com Target Milestone: --- [hjl@gnu-tools-1 tmp]$ cat /export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf/start.s .text .global start /* Used by SH targets. */ start: .global _start _start: .global __start __start: .global main /* Used by HPPA targets. */ main: .dc.a 0 [hjl@gnu-tools-1 tmp]$ as -o x.o /export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf/start.s [hjl@gnu-tools-1 tmp]$ ld -pie --no-dynamic-linker x.o [hjl@gnu-tools-1 tmp]$ readelf -l a.out Elf file type is DYN (Shared object file) Entry point 0x169 There are 4 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000178 0x0000000000000178 R E 0x200000 LOAD 0x0000000000000f20 0x0000000000200f20 0x0000000000200f20 0x00000000000000e0 0x00000000000000e0 RW 0x200000 DYNAMIC 0x0000000000000f20 0x0000000000200f20 0x0000000000200f20 0x00000000000000e0 0x00000000000000e0 RW 0x8 GNU_RELRO 0x0000000000000f20 0x0000000000200f20 0x0000000000200f20 0x00000000000000e0 0x00000000000000e0 R 0x1 Section to Segment mapping: Segment Sections... 00 .hash .gnu.hash .dynsym .dynstr .text 01 .dynamic 02 .dynamic 03 .dynamic [hjl@gnu-tools-1 tmp]$ ld.gold -pie x.o [hjl@gnu-tools-1 tmp]$ readelf -l a.out Elf file type is DYN (Shared object file) Entry point 0x1f0 There are 6 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align PHDR 0x0000000000000040 0x0000000000000040 0x0000000000000040 0x0000000000000150 0x0000000000000150 R 0x8 INTERP 0x0000000000000190 0x0000000000000190 0x0000000000000190 0x000000000000000f 0x000000000000000f R 0x1 [Requesting program interpreter: /lib/ld64.so.1] LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x00000000000001f8 0x00000000000001f8 R E 0x1000 LOAD 0x0000000000000f30 0x0000000000001f30 0x0000000000001f30 0x00000000000000d0 0x00000000000000d0 RW 0x1000 DYNAMIC 0x0000000000000f30 0x0000000000001f30 0x0000000000001f30 0x00000000000000d0 0x00000000000000d0 RW 0x8 GNU_RELRO 0x0000000000000f30 0x0000000000001f30 0x0000000000001f30 0x00000000000000d0 0x00000000000000d0 RW 0x8 Section to Segment mapping: Segment Sections... 00 01 .interp 02 .interp .dynsym .dynstr .gnu.hash .hash .text 03 .dynamic 04 .dynamic 05 .dynamic [hjl@gnu-tools-1 tmp]$ We have] 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_valid = 1; m->includes_phdrs = 1; It was reasonable 20 years ago. But it is wrong today when the primary OS of GNU ld is Linux. -- 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