1# REQUIRES: x86 2# RUN: echo '.text; ret; .data; .quad 0' > %t.s 3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o 4# RUN: ld.lld -o %t --script %s %t.o -shared 5# RUN: llvm-readelf -S --symbols -l %t | FileCheck %s 6 7PHDRS { 8 text PT_LOAD FLAGS(0x5); 9 data PT_LOAD FLAGS(0x6); 10} 11 12SECTIONS { 13 . = SIZEOF_HEADERS; 14 .text : { *(.text) } : text 15 . = ALIGN(CONSTANT(MAXPAGESIZE)); 16 foo : { __start_foo = .; *(foo); __end_foo = .; } : data 17 .data : { *(.data) } 18 .dynamic : { *(.dynamic) } 19} 20 21## Check that foo, the symbol only section, has the expected aligned address and 22## file offset. Also check that the section's symbols and the data segment's 23## offset and addresses match. 24 25# CHECK: Section Headers 26# CHECK: foo PROGBITS 0000000000[[ADDR:[0-9a-f]*]] [[ADDR]] 27# CHECK-NEXT: .data PROGBITS 0000000000[[ADDR]] [[ADDR]] 28 29# CHECK: Program Headers 30# CHECK: LOAD 31# CHECK-NEXT: LOAD 0x[[ADDR]] 0x0000000000[[ADDR]] 0x0000000000[[ADDR]] 32 33# CHECK: Symbol table 34# CHECK: 0000000000[[ADDR]] 0 NOTYPE GLOBAL DEFAULT {{[0-9]+}} __start_foo 35# CHECK: 0000000000[[ADDR]] 0 NOTYPE GLOBAL DEFAULT {{[0-9]+}} __end_foo 36