mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 18:26:06 +00:00

Summary: Based on Peter Collingbourne's suggestion in D56828. Before D56828: PT_LOAD(.data PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) .bss) Old: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro) .data .bss) New: PT_LOAD(PT_GNU_RELRO(.data.rel.ro .bss.rel.ro)) PT_LOAD(.data. .bss) The new layout reflects the runtime memory mappings. By having two PT_LOAD segments, we can utilize the NOBITS part of the first PT_LOAD and save bytes for .bss.rel.ro. .bss.rel.ro is currently small and only used by copy relocations of symbols in read-only segments, but it can be used for other purposes in the future, e.g. if a relro section's statically relocated data is all zeros, we can move it to .bss.rel.ro. Reviewers: espindola, ruiu, pcc Reviewed By: ruiu Subscribers: nemanjai, jvesely, nhaehnle, javed.absar, kbarton, emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58892 llvm-svn: 356226
13 lines
423 B
Plaintext
13 lines
423 B
Plaintext
# REQUIRES: x86
|
|
# RUN: echo '.section .foo, "aw"; .quad 42' \
|
|
# RUN: | llvm-mc -filetype=obj -triple=x86_64-pc-linux - -o %t.o
|
|
# RUN: ld.lld -o %t --script %s %t.o -shared
|
|
# RUN: llvm-readelf -S -l %t | FileCheck %s
|
|
|
|
SECTIONS {
|
|
.foo : ALIGN(2M) { *(.foo) }
|
|
}
|
|
|
|
# CHECK: .foo PROGBITS 0000000000200000 200000 000008 00 WA 0 0 2097152
|
|
# CHECK: LOAD 0x200000 0x0000000000200000 0x0000000000200000 {{.*}} RW 0x200000
|