1# REQUIRES: x86 2## Check that section ordering follows from input file ordering. 3# RUN: rm -rf %t; split-file %s %t 4# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/1.s -o %t/1.o 5# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/2.s -o %t/2.o 6# RUN: %lld -dylib %t/1.o %t/2.o -o %t/12 7# 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 16# RUN: llvm-objdump --macho --section-headers %t/12 | FileCheck %s --check-prefix=CHECK-12 17# 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 19 20# CHECK-12: __text 21# CHECK-12-NEXT: foo 22# CHECK-12-NEXT: bar 23# CHECK-12-NEXT: __cstring 24 25# CHECK-21: __text 26## `foo` always sorts next to `__text` since it's a code section 27## and needs to be adjacent for arm64 thunk calculations 28# CHECK-21-NEXT: foo 29# CHECK-21-NEXT: __cstring 30# CHECK-21-NEXT: bar 31 32# CHECK-SYNTHETIC-ORDER: __text 33# CHECK-SYNTHETIC-ORDER-NEXT: foo 34# CHECK-SYNTHETIC-ORDER-NEXT: __stubs 35# CHECK-SYNTHETIC-ORDER-NEXT: __stub_helper 36# CHECK-SYNTHETIC-ORDER-NEXT: __objc_stubs 37# CHECK-SYNTHETIC-ORDER-NEXT: __init_offsets 38# CHECK-SYNTHETIC-ORDER-NEXT: __cstring 39# CHECK-SYNTHETIC-ORDER-NEXT: bar 40# CHECK-SYNTHETIC-ORDER-NEXT: __unwind_info 41# CHECK-SYNTHETIC-ORDER-NEXT: __eh_frame 42# CHECK-SYNTHETIC-ORDER-NEXT: __objc_selrefs 43 44#--- 1.s 45.section __TEXT,foo 46 .space 1 47.section __TEXT,bar 48 .space 1 49.cstring 50 .asciz "" 51 52#--- 2.s 53.cstring 54 .asciz "" 55.section __TEXT,bar 56 .space 1 57.section __TEXT,foo,regular,pure_instructions 58 .space 1 59