1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux /dev/null -o %t.o
3# RUN: ld.lld -o %t.so -shared %t.o
4
5## Check we create PT_INTERP program header when it is specified in PHDRS.
6# RUN: echo "PHDRS { interp PT_INTERP; }" > %t1.script
7# RUN: ld.lld -o %t1 --script %t1.script %t.o %t.so --dynamic-linker foo
8# RUN: llvm-readobj -l %t1 | FileCheck %s
9# CHECK: PT_INTERP
10
11## Check we do not create it if it is not specified,
12## but only if PHDRS is not empty by itself.
13# RUN: echo "PHDRS { ph_text PT_LOAD; }" > %t2.script
14# RUN: ld.lld -o %t1 --script %t2.script %t.o %t.so --dynamic-linker foo
15# RUN: llvm-readobj -l %t1 | FileCheck %s --check-prefix=NOINTERP
16# NOINTERP-NOT: PT_INTERP
17
18## Otherwise, if PHDRS is empty, we create PT_INTERP header.
19# RUN: echo "PHDRS {}" > %t3.script
20# RUN: ld.lld -o %t1 --script %t3.script %t.o %t.so --dynamic-linker foo
21# RUN: llvm-readobj -l %t1 | FileCheck %s
22