1// REQUIRES: x86
2// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/copy-relocation-zero-abs-addr.s -o %t.o
3// RUN: ld.lld -shared -o %t2.so %t.o
4// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t3.o
5// RUN: ld.lld %t2.so %t3.o -o %t4
6// RUN: llvm-readobj --symbols %t2.so | FileCheck -check-prefix=ABSADDR %s
7// RUN: llvm-readobj -S -r --expand-relocs %t4 | FileCheck %s
8
9// This tests that symbols with absolute addresses are properly
10// handled. Normal DSO symbols are handled as usual.
11
12.text
13.globl _start
14_start:
15  movl $5, foo
16
17// ABSADDR:        Name: ver1
18// ABSADDR-NEXT:   Value: 0x0
19// ABSADDR-NEXT:   Size: 0
20// ABSADDR-NEXT:   Binding: Global
21// ABSADDR-NEXT:   Type: None
22// ABSADDR-NEXT:   Other: 0
23// ABSADDR-NEXT:   Section: Absolute (0xFFF1)
24// ABSADDR-NEXT: }
25// ABSADDR-NEXT: Symbol {
26// ABSADDR-NEXT:   Name: ver2
27// ABSADDR-NEXT:   Value: 0x0
28// ABSADDR-NEXT:   Size: 0
29// ABSADDR-NEXT:   Binding: Global
30// ABSADDR-NEXT:   Type: None
31// ABSADDR-NEXT:   Other: 0
32// ABSADDR-NEXT:   Section: Absolute (0xFFF1)
33// ABSADDR-NEXT: }
34
35// CHECK:      Relocations [
36// CHECK-NEXT:   Section (5) .rela.dyn {
37// CHECK-NEXT:     Relocation {
38// CHECK-NEXT:       Offset:
39// CHECK-NEXT:       Type: R_X86_64_COPY
40// CHECK-NEXT:       Symbol: foo
41// CHECK-NEXT:       Addend:
42// CHECK-NEXT:     }
43// CHECK-NEXT:   }
44// CHECK-NEXT: ]
45