bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/28743] -z relro creats holes in the process image on GNU/Linux


From: hjl.tools at gmail dot com
Subject: [Bug ld/28743] -z relro creats holes in the process image on GNU/Linux
Date: Mon, 10 Jan 2022 13:44:17 +0000

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

--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> ---
A simple testcase:

[hjl@gnu-tgl-3 pr28743-2]$ cat relro1.s 
        .globl main
        .globl start
        .globl _start
        .globl __start
        .text
main:
start:
_start:
__start:
        .long   0
        .data
        .long   0
        .section .data.rel.ro,"aw",%progbits
        .long   0
[hjl@gnu-tgl-3 pr28743-2]$ make
as -mx86-used-note=no  -o relro1.o relro1.s
./ld -z noseparate-code -z relro -o relro1 relro1.o
readelf -lSW relro1
There are 7 section headers, starting at offset 0x1128:

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .text             PROGBITS        00000000004000e8 0000e8 000004 00  AX 
0   0  1
  [ 2] .data.rel.ro      PROGBITS        0000000000401ffc 000ffc 000004 00  WA 
0   0  1
  [ 3] .data             PROGBITS        0000000000402000 001000 000004 00  WA 
0   0  1
  [ 4] .symtab           SYMTAB          0000000000000000 001008 0000c0 18     
5   1  8
  [ 5] .strtab           STRTAB          0000000000000000 0010c8 000026 00     
0   0  1
  [ 6] .shstrtab         STRTAB          0000000000000000 0010ee 000034 00     
0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  D (mbind), l (large), p (processor specific)

Elf file type is EXEC (Executable file)
Entry point 0x4000e8
There are 3 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz
  Flg Align
  LOAD           0x000000 0x0000000000400000 0x0000000000400000 0x0000ec
0x0000ec R E 0x1000
  LOAD           0x000ffc 0x0000000000401ffc 0x0000000000401ffc 0x000008
0x000008 RW  0x1000
  GNU_RELRO      0x000ffc 0x0000000000401ffc 0x0000000000401ffc 0x000004
0x000004 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     .text 
   01     .data.rel.ro .data 
   02     .data.rel.ro 
[hjl@gnu-tgl-3 pr28743-2]$

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