2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
4 # RUN: %p/Inputs/sort-nested.s -o %t2.o
6 ## Check sorting first by alignment and then by name.
7 # RUN: echo "SECTIONS { .aaa : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.aaa.*))) } }" > %t1.script
8 # RUN: ld.lld -o %t1 --script %t1.script %t1.o %t2.o
9 # RUN: llvm-objdump -s %t1 | FileCheck --check-prefix=SORTED_AN %s
10 # SORTED_AN: Contents of section .aaa:
11 # SORTED_AN-NEXT: 01000000 00000000 00000000 00000000
12 # SORTED_AN-NEXT: 11000000 00000000 00000000 00000000
13 # SORTED_AN-NEXT: 55000000 00000000 22000000 00000000
14 # SORTED_AN-NEXT: 02000000 00000000
16 ## Check sorting first by name and then by alignment.
17 # RUN: echo "SECTIONS { .aaa : { *(SORT_BY_NAME(SORT_BY_ALIGNMENT(.aaa.*))) } }" > %t2.script
18 # RUN: ld.lld -o %t2 --script %t2.script %t1.o %t2.o
19 # RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=SORTED_NA %s
20 # SORTED_NA: Contents of section .aaa:
21 # SORTED_NA: 01000000 00000000 00000000 00000000
22 # SORTED_NA: 11000000 00000000 22000000 00000000
23 # SORTED_NA: 02000000 00000000 00000000 00000000
24 # SORTED_NA: 55000000 00000000
26 ## If the section sorting command in linker script isn't nested, the
27 ## command line option will make the section sorting command to be treated
28 ## as nested sorting command.
29 # RUN: echo "SECTIONS { .aaa : { *(SORT_BY_ALIGNMENT(.aaa.*)) } }" > %t3.script
30 # RUN: ld.lld --sort-section name -o %t3 --script %t3.script %t1.o %t2.o
31 # RUN: llvm-objdump -s %t3 | FileCheck --check-prefix=SORTED_AN %s
32 # RUN: echo "SECTIONS { .aaa : { *(SORT_BY_NAME(.aaa.*)) } }" > %t4.script
33 # RUN: ld.lld --sort-section alignment -o %t4 --script %t4.script %t1.o %t2.o
34 # RUN: llvm-objdump -s %t4 | FileCheck --check-prefix=SORTED_NA %s