1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o 3 4# RUN: echo "SECTIONS { .text : { *(.text) } foo = .; .bar : { *(.bar) } }" > %t1.script 5# RUN: ld.lld -o %t1 --script %t1.script %t.o -shared 6# RUN: llvm-readobj --symbols -S --section-data %t1 | FileCheck %s 7 8.hidden foo 9.long foo - . 10 11.section .bar, "a" 12.long 0 13 14# The symbol foo is defined as a position in the file. This means that it is 15# not absolute and it is possible to compute the distance from foo to some other 16# position in the file. The symbol is not really in any output section, but 17# ELF has no magic constant for not absolute, but not in any section. 18# Fortunately the value of a symbol in a non relocatable file is a virtual 19# address, so the section can be arbitrary. 20 21# CHECK: Section { 22# CHECK: Index: 23# CHECK: Name: .text 24# CHECK-NEXT: Type: SHT_PROGBITS 25# CHECK-NEXT: Flags [ 26# CHECK-NEXT: SHF_ALLOC 27# CHECK-NEXT: SHF_EXECINSTR 28# CHECK-NEXT: ] 29# CHECK-NEXT: Address: 0x0 30# CHECK-NEXT: Offset: 31# CHECK-NEXT: Size: 4 32# CHECK-NEXT: Link: 33# CHECK-NEXT: Info: 34# CHECK-NEXT: AddressAlignment: 35# CHECK-NEXT: EntrySize: 36# CHECK-NEXT: SectionData ( 37# CHECK-NEXT: 0000: 04000000 | 38# CHECK-NEXT: ) 39# CHECK-NEXT: } 40 41# CHECK: Symbol { 42# CHECK: Name: foo 43# CHECK-NEXT: Value: 0x4 44# CHECK-NEXT: Size: 0 45# CHECK-NEXT: Binding: Local 46# CHECK-NEXT: Type: None 47# CHECK-NEXT: Other [ 48# CHECK-NEXT: STV_HIDDEN 49# CHECK-NEXT: ] 50# CHECK-NEXT: Section: .text 51# CHECK-NEXT: } 52