[PATCH] D59404: [ELF] Add a test for large .bss.rel.ro
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 19:37:30 PDT 2019
MaskRay created this revision.
MaskRay added reviewers: ruiu, pcc.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D59404
Files:
test/ELF/relro-bss.s
Index: test/ELF/relro-bss.s
===================================================================
--- /dev/null
+++ test/ELF/relro-bss.s
@@ -0,0 +1,34 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-readelf -l %t | FileCheck --check-prefix=SEGMENT %s
+# RUN: llvm-readelf -S %t | FileCheck %s
+
+# SEGMENT: .text
+# SEGMENT-NEXT: .data.rel.ro .bss.rel.ro
+# SEGMENT-NEXT: .data .bss
+
+# Because .bss.rel.ro is nobits, .data is placed in the next page
+# (sh_offset = alignTo(0x2001, 4096) = 0x3000).
+
+# [Nr] Name Type Address Off Size
+# CHECK: .data.rel.ro PROGBITS 0000000000202000 002000 000001
+# CHECK-NEXT: .bss.rel.ro NOBITS 0000000000202001 002001 002000
+# CHECK-NEXT: .data PROGBITS 0000000000205000 003000 000001
+# CHECK-NEXT: .bss NOBITS 0000000000205001 003001 000001
+
+.globl _start
+_start:
+ ret
+
+.section .data.rel.ro, "aw"
+.space 1
+
+.section .bss.rel.ro, "aw", @nobits
+.space 8192
+
+.section .data, "aw"
+.space 1
+
+.section .bss, "aw"
+.space 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59404.190773.patch
Type: text/x-patch
Size: 1173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190315/2a3158e0/attachment.bin>
More information about the llvm-commits
mailing list