1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t 3 4## Default case: abc and abx included in text. 5# RUN: echo "SECTIONS { \ 6# RUN: .text : { *(.abc .abx) } }" > %t.script 7# RUN: ld.lld -o %t.out --script %t.script %t 8# RUN: llvm-objdump --section-headers %t.out | \ 9# RUN: FileCheck -check-prefix=SEC-DEFAULT %s 10# SEC-DEFAULT: Sections: 11# SEC-DEFAULT-NEXT: Idx Name Size 12# SEC-DEFAULT-NEXT: 0 00000000 13# SEC-DEFAULT-NEXT: 1 .text 00000008 14# SEC-DEFAULT-NEXT: 2 .abcd 00000004 15# SEC-DEFAULT-NEXT: 3 .ad 00000004 16# SEC-DEFAULT-NEXT: 4 .ag 00000004 17# SEC-DEFAULT-NEXT: 5 .comment 00000008 {{[0-9a-f]*}} 18# SEC-DEFAULT-NEXT: 6 .symtab 00000030 19# SEC-DEFAULT-NEXT: 7 .shstrtab 00000038 20# SEC-DEFAULT-NEXT: 8 .strtab 00000008 21 22## Now replace the symbol with '?' and check that results are the same. 23# RUN: echo "SECTIONS { \ 24# RUN: .text : { *(.abc .ab?) } }" > %t.script 25# RUN: ld.lld -o %t.out --script %t.script %t 26# RUN: llvm-objdump --section-headers %t.out | \ 27# RUN: FileCheck -check-prefix=SEC-DEFAULT %s 28 29## Now see how replacing '?' with '*' will consume whole abcd. 30# RUN: echo "SECTIONS { \ 31# RUN: .text : { *(.abc .ab*) } }" > %t.script 32# RUN: ld.lld -o %t.out --script %t.script %t 33# RUN: llvm-objdump --section-headers %t.out | \ 34# RUN: FileCheck -check-prefix=SEC-ALL %s 35# SEC-ALL: Sections: 36# SEC-ALL-NEXT: Idx Name Size 37# SEC-ALL-NEXT: 0 00000000 38# SEC-ALL-NEXT: 1 .text 0000000c 39# SEC-ALL-NEXT: 2 .ad 00000004 40# SEC-ALL-NEXT: 3 .ag 00000004 41# SEC-ALL-NEXT: 4 .comment 00000008 42# SEC-ALL-NEXT: 5 .symtab 00000030 43# SEC-ALL-NEXT: 6 .shstrtab 00000032 44# SEC-ALL-NEXT: 7 .strtab 00000008 45 46## All sections started with .a are merged. 47# RUN: echo "SECTIONS { \ 48# RUN: .text : { *(.a*) } }" > %t.script 49# RUN: ld.lld -o %t.out --script %t.script %t 50# RUN: llvm-objdump --section-headers %t.out | \ 51# RUN: FileCheck -check-prefix=SEC-NO %s 52# SEC-NO: Sections: 53# SEC-NO-NEXT: Idx Name Size 54# SEC-NO-NEXT: 0 00000000 55# SEC-NO-NEXT: 1 .text 00000014 56# SEC-NO-NEXT: 2 .comment 00000008 57# SEC-NO-NEXT: 3 .symtab 00000030 58# SEC-NO-NEXT: 4 .shstrtab 0000002a 59# SEC-NO-NEXT: 5 .strtab 00000008 60 61.text 62.section .abc,"ax",@progbits 63.long 0 64 65.text 66.section .abx,"ax",@progbits 67.long 0 68 69.text 70.section .abcd,"ax",@progbits 71.long 0 72 73.text 74.section .ad,"ax",@progbits 75.long 0 76 77.text 78.section .ag,"ax",@progbits 79.long 0 80 81 82.globl _start 83_start: 84