1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
3# RUN: echo "SECTIONS { A = . - 0x10; B = A + 0x1; }" > %t.script
4# RUN: ld.lld -shared %t1.o --script %t.script -o %t
5# RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=DUMP
6# RUN: llvm-readobj --symbols %t | FileCheck %s --check-prefix=SYMBOL
7
8# B = A + 0x1 = -0x10 + 0x1 = -0xf -> 0xFFFFFFFFFFFFFFF1
9# B - (0x94+6) = -0xf - (0x94+6) = -169
10# DUMP:       Disassembly of section .text:
11# DUMP-EMPTY:
12# DUMP-NEXT:  <foo>:
13# DUMP-NEXT:   94: {{.*}} -169(%rip), %eax
14
15# SYMBOL:     Symbol {
16# SYMBOL:        Name: B
17# SYMBOL-NEXT:   Value: 0xFFFFFFFFFFFFFFF1
18# SYMBOL-NEXT:   Size: 0
19# SYMBOL-NEXT:   Binding: Local
20# SYMBOL-NEXT:   Type: None
21# SYMBOL-NEXT:   Other [
22# SYMBOL-NEXT:     STV_HIDDEN
23# SYMBOL-NEXT:   ]
24# SYMBOL-NEXT:   Section: .dynsym
25# SYMBOL-NEXT: }
26
27.text
28.globl foo
29.type foo, @function
30foo:
31 movl B(%rip), %eax
32
33.hidden B
34