[PATCH] D111137: [ELF] Propagate phdrs to orphan section with a smaller rank

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 15 06:18:03 PDT 2021


ikudrin added a comment.

While disabling RELRO fixes the particular example, it is not the ultimate solution for the issue. It does not help, for example, if `.data` is replaced with `.bss` in the test:

  > cat test.s
    .text
    nop
  
    .bss
    .quad 0
  > cat test.lds
  PHDRS {
    exec PT_LOAD;
    rw   PT_LOAD;
  }
  SECTIONS {
    .text : { *(.text) } : exec
    .bss : { *(.bss) } : rw
  }
  > llvm-mc -filetype=obj -triple=x86_64 test.s -o test.o
  > ld.lld -z norelro -pie test.o -T test.lds -o test.out
  > llvm-readelf -l test.out
  ...
  Program Headers:
    Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
    LOAD           0x001000 0x0000000000000000 0x0000000000000000 0x0000e0 0x0000e0 RWE 0x1000
    LOAD           0x0010e0 0x00000000000000e0 0x00000000000000e0 0x000000 0x000008 RW  0x1000
  
   Section to Segment mapping:
    Segment Sections...
     00     .dynsym .gnu.hash .hash .dynstr .text .dynamic 
     01     .bss 
     None   .comment .symtab .shstrtab .strtab 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111137/new/

https://reviews.llvm.org/D111137



More information about the llvm-commits mailing list