aboutsummaryrefslogtreecommitdiff
path: root/test/old-elf/linkerscript/phdrs-misplaced-program.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/linkerscript/phdrs-misplaced-program.test')
-rw-r--r--test/old-elf/linkerscript/phdrs-misplaced-program.test26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/old-elf/linkerscript/phdrs-misplaced-program.test b/test/old-elf/linkerscript/phdrs-misplaced-program.test
new file mode 100644
index 000000000000..0fb669d818c4
--- /dev/null
+++ b/test/old-elf/linkerscript/phdrs-misplaced-program.test
@@ -0,0 +1,26 @@
+/*
+Test misplaced program header generates error.
+
+RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o
+
+RUN: not lld -flavor old-gnu -target x86_64 -T %s %t.o -static -o %t1 &> %t1-error
+RUN: FileCheck -check-prefix MISPLACED-PROGRAM-PHDR %s < %t1-error
+*/
+
+ENTRY(_start)
+
+PHDRS
+{
+ text PT_LOAD;
+ header PT_PHDR PHDRS;
+}
+
+SECTIONS
+{
+ .text : { *(.text) } :NONE
+ .data : { *(.data) }
+}
+
+/*
+MISPLACED-PROGRAM-PHDR: Program header must precede load segments
+*/