Skip to content

Commit 2e5a0b3

Browse files
committed
[lld-macho][test] Add test case for section ordering
This covers the special section ordering handling. This chooses to fake the sections vs creating them organically which is probably a bit easier to maintain. Differential Revision: https://reviews.llvm.org/D139959
1 parent 6a285b5 commit 2e5a0b3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lld/test/MachO/section-order.s

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@
55
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/2.s -o %t/2.o
66
# RUN: %lld -dylib %t/1.o %t/2.o -o %t/12
77
# RUN: %lld -dylib %t/2.o %t/1.o -o %t/21
8+
# RUN: %lld -dylib %t/2.o %t/1.o -o %t/synth-section-order \
9+
# RUN: -add_empty_section __TEXT __objc_stubs \
10+
# RUN: -add_empty_section __TEXT __init_offsets \
11+
# RUN: -add_empty_section __TEXT __stubs \
12+
# RUN: -add_empty_section __TEXT __stub_helper \
13+
# RUN: -add_empty_section __TEXT __unwind_info \
14+
# RUN: -add_empty_section __TEXT __eh_frame \
15+
# RUN: -add_empty_section __DATA __objc_selrefs
816
# RUN: llvm-objdump --macho --section-headers %t/12 | FileCheck %s --check-prefix=CHECK-12
917
# RUN: llvm-objdump --macho --section-headers %t/21 | FileCheck %s --check-prefix=CHECK-21
18+
# RUN: llvm-objdump --macho --section-headers %t/synth-section-order | FileCheck %s --check-prefix=CHECK-SYNTHETIC-ORDER
1019

1120
# CHECK-12: __text
1221
# CHECK-12-NEXT: foo
@@ -18,6 +27,18 @@
1827
# CHECK-21-NEXT: bar
1928
# CHECK-21-NEXT: foo
2029

30+
# CHECK-SYNTHETIC-ORDER: __text
31+
# CHECK-SYNTHETIC-ORDER-NEXT: __stubs
32+
# CHECK-SYNTHETIC-ORDER-NEXT: __stub_helper
33+
# CHECK-SYNTHETIC-ORDER-NEXT: __objc_stubs
34+
# CHECK-SYNTHETIC-ORDER-NEXT: __init_offsets
35+
# CHECK-SYNTHETIC-ORDER-NEXT: __cstring
36+
# CHECK-SYNTHETIC-ORDER-NEXT: bar
37+
# CHECK-SYNTHETIC-ORDER-NEXT: foo
38+
# CHECK-SYNTHETIC-ORDER-NEXT: __unwind_info
39+
# CHECK-SYNTHETIC-ORDER-NEXT: __eh_frame
40+
# CHECK-SYNTHETIC-ORDER-NEXT: __objc_selrefs
41+
2142
#--- 1.s
2243
.section __TEXT,foo
2344
.space 1

0 commit comments

Comments
 (0)