bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/22423] New: PT_PHDR segment is marked with PF_X


From: hjl.tools at gmail dot com
Subject: [Bug ld/22423] New: PT_PHDR segment is marked with PF_X
Date: Sun, 12 Nov 2017 01:07:07 +0000

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: ---

address@hidden 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
address@hidden tmp]$ as -o x.o
/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf/start.s
address@hidden tmp]$ ld -pie --no-dynamic-linker x.o
address@hidden 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 
address@hidden tmp]$ ld.gold -pie  x.o
address@hidden 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 
address@hidden 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]