1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3# RUN: echo "PHDRS {" > %t.script
4# RUN: echo " ph_text PT_LOAD FLAGS (0x1 | 0x4);" >> %t.script
5# RUN: echo " ph_data PT_LOAD FLAGS (0x2 | 0x4);" >> %t.script
6# RUN: echo "}" >> %t.script
7# RUN: echo "SECTIONS {" >> %t.script
8# RUN: echo " .text : { *(.text*) } : ph_text" >> %t.script
9# RUN: echo " . = ALIGN(0x4000);" >> %t.script
10# RUN: echo " .got.plt : { BYTE(42); *(.got); } : ph_data" >> %t.script
11# RUN: echo "}" >> %t.script
12# RUN: ld.lld -T %t.script %t.o -o %t.elf
13# RUN: llvm-readelf -l %t.elf | FileCheck %s
14
15# CHECK: Section to Segment mapping:
16# CHECK-NEXT: Segment Sections...
17# CHECK-NEXT: 00 .text executable
18# CHECK-NEXT: 01 .got.plt
19
20.text
21.globl _start
22.type _start,@function
23_start:
24    callq custom_func
25    ret
26
27.section executable,"ax",@progbits
28.type custom_func,@function
29custom_func:
30    ret
31