brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · f4ecf27 Raw
36 lines · plain
1# REQUIRES: x862# RUN: echo '.text; ret; .data; .quad 0' > %t.s3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o4# RUN: ld.lld -o %t --script %s %t.o -shared5# RUN: llvm-readelf -S --symbols -l %t | FileCheck %s6 7PHDRS {8  text PT_LOAD FLAGS(0x5);9  data PT_LOAD FLAGS(0x6);10}11 12SECTIONS {13  . = SIZEOF_HEADERS;14  .text : { *(.text) } : text15  . = ALIGN(CONSTANT(MAXPAGESIZE));16  foo : { __start_foo = .; *(foo); __end_foo = .; } : data17  .data : { *(.data) }18  .dynamic : { *(.dynamic) }19}20 21## Check that foo, the symbol only section, has the expected aligned address and22## file offset. Also check that the section's symbols and the data segment's23## offset and addresses match.24 25# CHECK: Section Headers26# CHECK:      foo   PROGBITS 0000000000[[ADDR:[0-9a-f]*]] [[ADDR]]27# CHECK-NEXT: .data PROGBITS 0000000000[[ADDR]] [[ADDR]]28 29# CHECK: Program Headers30# CHECK:      LOAD31# CHECK-NEXT: LOAD 0x[[ADDR]] 0x0000000000[[ADDR]] 0x0000000000[[ADDR]]32 33# CHECK: Symbol table34# CHECK: 0000000000[[ADDR]] 0 NOTYPE GLOBAL DEFAULT {{[0-9]+}} __start_foo35# CHECK: 0000000000[[ADDR]] 0 NOTYPE GLOBAL DEFAULT {{[0-9]+}} __end_foo36