2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
4 ## In this test we check that output section types such as
5 ## COPY, INFO and OVERLAY marks output section as non-allocatable.
7 # RUN: echo "SECTIONS { .bar : { *(.foo) } };" > %t.script
8 # RUN: ld.lld -o %t --script %t.script %t.o
9 # RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=DEFAULT
11 # DEFAULT: Type: SHT_PROGBITS
12 # DEFAULT-NEXT: Flags [
13 # DEFAULT-NEXT: SHF_ALLOC
16 # RUN: echo "SECTIONS { .bar (COPY) : { *(.foo) } };" > %t.script
17 # RUN: ld.lld -o %t --script %t.script %t.o
18 # RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=NONALLOC
19 # NONALLOC: Name: .bar
20 # NONALLOC: Type: SHT_PROGBITS
21 # NONALLOC-NEXT: Flags [
24 # RUN: echo "SECTIONS { .bar (INFO) : { *(.foo) } };" > %t.script
25 # RUN: ld.lld -o %t --script %t.script %t.o
26 # RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=NONALLOC
28 # RUN: echo "SECTIONS { .bar (OVERLAY) : { *(.foo) } };" > %t.script
29 # RUN: ld.lld -o %t --script %t.script %t.o
30 # RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=NONALLOC
32 # RUN: echo "SECTIONS { .bar (INFO) : { . += 1; } };" > %t.script
33 # RUN: ld.lld -o %t --script %t.script %t.o
34 # RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=NONALLOC
36 # RUN: echo "SECTIONS { .bar 0x20000 (INFO) : { *(.foo) } };" > %t.script
37 # RUN: ld.lld -o %t --script %t.script %t.o
38 # RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix=NONALLOC
40 # RUN: echo "SECTIONS { .bar 0x20000 (BAR) : { *(.foo) } };" > %t.script
41 # RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 |\
42 # RUN: FileCheck %s --check-prefix=UNKNOWN
43 # UNKNOWN: unknown section directive: BAR
45 .section .foo,"a",@progbits