Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / sectcreate.s
blob919c553dd76280f5378272c05b742296d80a1752
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
3 # RUN: echo "-sectcreate 1.1" >%t1
4 # RUN: echo "-sectcreate 1.2" >%t2
5 # RUN: echo "-sectcreate 2" >%t3
6 # RUN: %lld \
7 # RUN: -sectcreate SEG SEC1 %t1 \
8 # RUN: -segcreate SEG SEC2 %t3 \
9 # RUN: -sectcreate SEG SEC1 %t2 \
10 # RUN: -add_empty_section __DATA __data \
11 # RUN: -o %t %t.o
12 # RUN: llvm-objdump -s %t | FileCheck %s
14 ## -dead_strip does not strip -sectcreate sections,
15 ## but also doesn't set S_ATTR_NO_DEAD_STRIP on them.
16 # RUN: %lld -dead_strip \
17 # RUN: -sectcreate SEG SEC1 %t1 \
18 # RUN: -segcreate SEG SEC2 %t3 \
19 # RUN: -sectcreate SEG SEC1 %t2 \
20 # RUN: -add_empty_section SEG SEC1 \
21 # RUN: -o %t %t.o
22 # RUN: llvm-objdump -s %t | FileCheck --check-prefix=STRIPPED %s
23 # RUN: llvm-readobj --sections %t | FileCheck --check-prefix=STRIPPEDSEC %s
25 # RUN: %lld -add_empty_section foo bar -o %t %t.o
26 # RUN: llvm-readobj --sections %t | FileCheck --check-prefix=EMPTYSECTION %s
28 # RUN: %lld -sectcreate SEG SEC1 %t1 -add_empty_section SEG SEC1 -o %t %t.o
29 # RUN: llvm-readobj --sections %t | FileCheck --check-prefix=CREATEDANDEMPTY %s
31 # CHECK: Contents of section __TEXT,__text:
32 # CHECK: Contents of section __DATA,__data:
33 # CHECK: my string!.
34 # CHECK: Contents of section SEG,SEC1:
35 # CHECK: -sectcreate 1.1.
36 # CHECK: -sectcreate 1.2.
37 # CHECK: Contents of section SEG,SEC2:
38 # CHECK: -sectcreate 2.
40 # STRIPPED: Contents of section __TEXT,__text:
41 # STRIPPED-NOT: Contents of section __DATA,__data:
42 # STRIPPED-NOT: my string!.
43 # STRIPPED: Contents of section SEG,SEC1:
44 # STRIPPED: -sectcreate 1.1.
45 # STRIPPED: -sectcreate 1.2.
46 # STRIPPED: Contents of section SEG,SEC2:
47 # STRIPPED: -sectcreate 2.
49 # STRIPPEDSEC-NOT: NoDeadStrip
51 # EMPTYSECTION: Name: bar
52 # EMPTYSECTION: Segment: foo
53 # EMPTYSECTION: Size: 0x0
54 # EMPTYSECTION-NOT: Name:
56 # CREATEDANDEMPTY: Name: SEC1
57 # CREATEDANDEMPTY: Segment: SEG
58 # CREATEDANDEMPTY: Size: 0x10
59 # CREATEDANDEMPTY-NOT: Name:
61 .text
62 .global _main
63 _main:
64 mov $0, %eax
65 ret
67 .data
68 .global my_string
69 my_string:
70 .string "my string!"
72 .subsections_via_symbols