summaryrefslogtreecommitdiff
path: root/test/old-elf/linkerscript/phdrs-same-flags.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/linkerscript/phdrs-same-flags.test')
-rw-r--r--test/old-elf/linkerscript/phdrs-same-flags.test35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/old-elf/linkerscript/phdrs-same-flags.test b/test/old-elf/linkerscript/phdrs-same-flags.test
new file mode 100644
index 000000000000..e39f61881033
--- /dev/null
+++ b/test/old-elf/linkerscript/phdrs-same-flags.test
@@ -0,0 +1,35 @@
+/*
+Test sections put to same segment with FLAGS attribute set.
+
+RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o
+
+RUN: lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1
+RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-SECS %s
+RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix FLAGS-PHDRS-HDRS %s
+*/
+
+ENTRY(_start)
+
+PHDRS
+{
+ text PT_LOAD FLAGS(0x4);
+}
+
+SECTIONS
+{
+ .text : { *(.text) } :text
+ .data : { *(.data) }
+}
+
+/*
+FLAGS-PHDRS-SECS: .text {{[0-9a-f]+}} 00000000004000b0
+FLAGS-PHDRS-SECS: .data {{[0-9a-f]+}} 00000000004000dc
+
+FLAGS-PHDRS-HDRS: ProgramHeader {
+FLAGS-PHDRS-HDRS: Type: PT_LOAD (0x1)
+FLAGS-PHDRS-HDRS: VirtualAddress: 0x400000
+FLAGS-PHDRS-HDRS: Flags [ (0x4)
+FLAGS-PHDRS-HDRS: PF_R (0x4)
+FLAGS-PHDRS-HDRS: ]
+FLAGS-PHDRS-HDRS: }
+*/