51 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \4# RUN: %p/Inputs/sort-nested.s -o %t2.o5 6## Check sorting first by alignment and then by name.7# RUN: echo "SECTIONS { .aaa : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.aaa.*))) } }" > %t1.script8# RUN: ld.lld -o %t1 --script %t1.script %t1.o %t2.o9# RUN: llvm-objdump -s %t1 | FileCheck --check-prefix=SORTED_AN %s10# SORTED_AN: Contents of section .aaa:11# SORTED_AN-NEXT: 01000000 00000000 00000000 0000000012# SORTED_AN-NEXT: 11000000 00000000 00000000 0000000013# SORTED_AN-NEXT: 55000000 00000000 22000000 0000000014# SORTED_AN-NEXT: 02000000 0000000015 16## Check sorting first by name and then by alignment.17# RUN: echo "SECTIONS { .aaa : { *(SORT_BY_NAME(SORT_BY_ALIGNMENT(.aaa.*))) } }" > %t2.script18# RUN: ld.lld -o %t2 --script %t2.script %t1.o %t2.o19# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=SORTED_NA %s20# SORTED_NA: Contents of section .aaa:21# SORTED_NA: 01000000 00000000 00000000 0000000022# SORTED_NA: 11000000 00000000 22000000 0000000023# SORTED_NA: 02000000 00000000 00000000 0000000024# SORTED_NA: 55000000 0000000025 26## If the section sorting command in linker script isn't nested, the27## command line option will make the section sorting command to be treated28## as nested sorting command.29# RUN: echo "SECTIONS { .aaa : { *(SORT_BY_ALIGNMENT(.aaa.*)) } }" > %t3.script30# RUN: ld.lld --sort-section name -o %t3 --script %t3.script %t1.o %t2.o31# RUN: llvm-objdump -s %t3 | FileCheck --check-prefix=SORTED_AN %s32# RUN: echo "SECTIONS { .aaa : { *(SORT_BY_NAME(.aaa.*)) } }" > %t4.script33# RUN: ld.lld --sort-section alignment -o %t4 --script %t4.script %t1.o %t2.o34# RUN: llvm-objdump -s %t4 | FileCheck --check-prefix=SORTED_NA %s35 36.global _start37_start:38 nop39 40.section .aaa.1, "a"41.align 3242.quad 143 44.section .aaa.2, "a"45.align 246.quad 247 48.section .aaa.5, "a"49.align 1650.quad 0x5551