summaryrefslogtreecommitdiff
path: root/test/elf/rosegment.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/elf/rosegment.test')
-rw-r--r--test/elf/rosegment.test26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/elf/rosegment.test b/test/elf/rosegment.test
new file mode 100644
index 0000000000000..32638d8fce6fd
--- /dev/null
+++ b/test/elf/rosegment.test
@@ -0,0 +1,26 @@
+# Tests that the option --rosegment produces an output file with a separate
+# segment created for read only data.
+RUN: lld -flavor gnu -target x86_64 %p/Inputs/rodata.o -o %t1.elf \
+RUN: --noinhibit-exec
+RUN: lld -flavor gnu -target x86_64 %p/Inputs/rodata.o --rosegment -o %t2.elf \
+RUN: --noinhibit-exec
+RUN: llvm-readobj -program-headers %t1.elf | FileCheck %s -check-prefix=NORO-SEGMENT
+RUN: llvm-readobj -program-headers %t2.elf | FileCheck %s -check-prefix=RO-SEGMENT
+
+#NORO-SEGMENT: Type: PT_PHDR
+#NORO-SEGMENT: Type: PT_INTERP
+#NORO-SEGMENT: Type: PT_LOAD
+#NORO-SEGMENT: Type: PT_LOAD
+#NORO-SEGMENT: Type: PT_DYNAMIC
+#NORO-SEGMENT: Type: PT_GNU_EH_FRAME
+
+#RO-SEGMENT: Type: PT_PHDR
+#RO-SEGMENT: Type: PT_INTERP
+#RO-SEGMENT: Type: PT_LOAD
+#RO-SEGMENT: Type: PT_LOAD
+#RO-SEGMENT: Flags [
+#RO-SEGMENT: PF_R (0x4)
+#RO-SEGMENT: ]
+#RO-SEGMENT: Type: PT_LOAD
+#RO-SEGMENT: Type: PT_DYNAMIC
+#RO-SEGMENT: Type: PT_GNU_EH_FRAME