1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3
4## Test that section .foo is not placed in any segment when assigned to segment
5## NONE in the linker script and segment NONE is not defined.
6# RUN: echo "PHDRS {text PT_LOAD;} \
7# RUN:       SECTIONS { \
8# RUN:           .text : {*(.text .text*)} :text \
9# RUN:           .foo : {*(.foo)} :NONE \
10# RUN:       }" > %t.script
11# RUN: ld.lld -o %t --script %t.script %t.o
12# RUN: llvm-readelf -S -l %t | FileCheck %s
13
14## Test that section .foo is placed in segment NONE when assigned to segment
15## NONE in the linker script and segment NONE is defined.
16# RUN: echo "PHDRS {text PT_LOAD; NONE PT_LOAD;} \
17# RUN:       SECTIONS { \
18# RUN:           .text : {*(.text .text*)} :text \
19# RUN:           .foo : {*(.foo)} :NONE \
20# RUN:       }" > %t.script
21# RUN: ld.lld -o %t --script %t.script %t.o
22# RUN: llvm-readelf -S -l %t | FileCheck --check-prefix=DEFINED %s
23
24# CHECK: Section to Segment mapping:
25# CHECK-NEXT: Segment Sections...
26# CHECK: None {{.*}}.foo
27
28# DEFINED: Section to Segment mapping:
29# DEFINED-NEXT: Segment Sections...
30# DEFINED-NEXT:  00     .text
31# DEFINED-NEXT:  01     .foo
32
33.global _start
34_start:
35 nop
36
37.section .foo,"a"
38foo:
39 .long 0
40