48 lines · plain
1# REQUIRES: x862## Test quotation when specifying section names.3 4# RUN: rm -rf %t && split-file %s %t && cd %t5# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o6# RUN: ld.lld -T a.t a.o7# RUN: llvm-readelf -S -s a.out | FileCheck %s8 9# CHECK: Name Type Address Off Size ES Flg Lk Inf Al10# CHECK-NEXT: NULL 0000000000000000 000000 000000 00 0 0 011# CHECK-NEXT: .text {{.*}}12# CHECK-NEXT: .data {{.*}}13# CHECK: Num: Value Size Type Bind Vis Ndx Name14# CHECK-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND15# CHECK-NEXT: 1: 0000000000000009 0 NOTYPE GLOBAL DEFAULT ABS text_size16# CHECK-NEXT: 2: 0000000000000009 0 NOTYPE GLOBAL DEFAULT ABS data_size17 18#--- a.s19 .text20 nop21 22 .data23 .byte 024 25#--- a.t26SECTIONS {27 ## Check quoted section names are accepted and quotes are removed in the28 ## output binary section name.29 ##30 ## Also check that functions taking a section name as parameter work correctly31 ## when quoted section names are provided as inputs.32 ".text" : AT(ADDR(".text")) {33 LONG (ALIGNOF(".text"))34 LONG (LOADADDR(".text"))35 *(.text)36 }37 text_size = SIZEOF(".text");38 39 ## Check that functions that take a section name can correctly match a quoted40 ## section name input parameter against a non-quoted section definition.41 .data : AT(ADDR(".data")) {42 LONG (ALIGNOF(".data"))43 LONG (LOADADDR(".data"))44 *(.data)45 }46 data_size = SIZEOF(".data");47}48