https://sourceware.org/bugzilla/show_bug.cgi?id=32191

            Bug ID: 32191
           Summary: --rosegment places .note.gnu.property in executable
                    PT_LOAD segment for -z separate-code
           Product: binutils
           Version: 2.44 (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-tgl-3 tmp]$ cat x.c
int
main ()
{
}
[hjl@gnu-tgl-3 tmp]$ gcc x.c -fPIC -shared -Wl,-z,separate-code
-Wl,--no-rosegment
[hjl@gnu-tgl-3 tmp]$ readelf -lW a.out 

Elf file type is DYN (Shared object file)
Entry point 0x0
There are 11 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz
  Flg Align
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x000518
0x000518 R   0x1000
  LOAD           0x001000 0x0000000000001000 0x0000000000001000 0x000111
0x000111 R E 0x1000
  LOAD           0x002000 0x0000000000002000 0x0000000000002000 0x0000a4
0x0000a4 R   0x1000
  LOAD           0x002df0 0x0000000000003df0 0x0000000000003df0 0x000210
0x000218 RW  0x1000
  DYNAMIC        0x002e08 0x0000000000003e08 0x0000000000003e08 0x0001c0
0x0001c0 RW  0x8
  NOTE           0x0002a8 0x00000000000002a8 0x00000000000002a8 0x000030
0x000030 R   0x8
  NOTE           0x0002d8 0x00000000000002d8 0x00000000000002d8 0x000024
0x000024 R   0x4
  GNU_PROPERTY   0x0002a8 0x00000000000002a8 0x00000000000002a8 0x000030
0x000030 R   0x8
  GNU_EH_FRAME   0x002000 0x0000000000002000 0x0000000000002000 0x000024
0x000024 R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW  0x10
  GNU_RELRO      0x002df0 0x0000000000003df0 0x0000000000003df0 0x000210
0x000210 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     .note.gnu.property .note.gnu.build-id .gnu.hash .dynsym .dynstr
.gnu.version .gnu.version_r .rela.dyn 
   01     .init .plt .plt.got .text .fini 
   02     .eh_frame_hdr .eh_frame 
   03     .init_array .fini_array .data.rel.ro .dynamic .got .got.plt .bss 
   04     .dynamic 
   05     .note.gnu.property 
   06     .note.gnu.build-id 
   07     .note.gnu.property 
   08     .eh_frame_hdr 
   09     
   10     .init_array .fini_array .data.rel.ro .dynamic .got .got.plt 
[hjl@gnu-tgl-3 tmp]$ gcc x.c -fPIC -shared -Wl,-z,separate-code -Wl,--rosegment
[hjl@gnu-tgl-3 tmp]$ readelf -lW a.out 

Elf file type is DYN (Shared object file)
Entry point 0x0
There are 10 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz
  Flg Align
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x001148
0x001148 R E 0x1000
  LOAD           0x002000 0x0000000000002000 0x0000000000002000 0x0002e4
0x0002e4 R   0x1000
  LOAD           0x002df0 0x0000000000003df0 0x0000000000003df0 0x000210
0x000218 RW  0x1000
  DYNAMIC        0x002e08 0x0000000000003e08 0x0000000000003e08 0x0001c0
0x0001c0 RW  0x8
  NOTE           0x001118 0x0000000000001118 0x0000000000001118 0x000030
0x000030 R   0x8
  NOTE           0x002000 0x0000000000002000 0x0000000000002000 0x000024
0x000024 R   0x4
  GNU_PROPERTY   0x001118 0x0000000000001118 0x0000000000001118 0x000030
0x000030 R   0x8
  GNU_EH_FRAME   0x002240 0x0000000000002240 0x0000000000002240 0x000024
0x000024 R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000
0x000000 RW  0x10
  GNU_RELRO      0x002df0 0x0000000000003df0 0x0000000000003df0 0x000210
0x000210 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     .init .plt .plt.got .text .fini .note.gnu.property 
   01     .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version
.gnu.version_r .rela.dyn .eh_frame_hdr .eh_frame 
   02     .init_array .fini_array .data.rel.ro .dynamic .got .got.plt .bss 
   03     .dynamic 
   04     .note.gnu.property 
   05     .note.gnu.build-id 
   06     .note.gnu.property 
   07     .eh_frame_hdr 
   08     
   09     .init_array .fini_array .data.rel.ro .dynamic .got .got.plt 
[hjl@gnu-tgl-3 tmp]$ 

.note.gnu.property shouldn't be in the same segment as .text section.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to