[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / copy-relocation-zero-addr.s
blob9a1c6c7062efaf6aad72f9c5a32b3f02196efd4e
1 # REQUIRES: x86
2 # RUN: split-file %s %t
3 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o
4 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/b.s -o %t/b.o
5 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/c.s -o %t/c.o
6 # RUN: ld.lld -shared -soname=b -Ttext=0 %t/b.o -o %t/b.so
8 # RUN: ld.lld %t/a.o %t/b.so -o %t1
9 # RUN: llvm-readelf -r -s %t1 | FileCheck %s
11 ## In %t/b.so, foo has st_value==0 and its section alignment is 0x400. The
12 ## alignment of the copy relocated foo is thus 0x400.
13 # CHECK: R_X86_64_COPY {{.*}} foo + 0
14 # CHECK: 0000000000203400 4 OBJECT GLOBAL DEFAULT [[#]] foo
16 ## Error if attempting to copy relocate a SHN_ABS symbol (even if st_size is non-zero).
17 # RUN: ld.lld -shared -soname=c %t/c.o -o %t/c.so
18 # RUN: llvm-readelf -s %t/c.so | FileCheck %s --check-prefix=ABSADDR
19 # RUN: not ld.lld %t/a.o %t/c.so -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR
21 # ABSADDR: 0000000000000000 4 OBJECT GLOBAL DEFAULT ABS foo
22 # ERR: error: cannot create a copy relocation for symbol foo
24 #--- a.s
25 .text
26 .globl _start
27 _start:
28 movl $5, foo
30 #--- b.s
31 .data
32 .balign 0x400
33 .type foo,@object
34 .globl foo
35 foo:
36 .long 0
37 .size foo, 4
39 #--- c.s
40 .data
41 .globl foo
42 .type foo,@object
43 foo = 0x0
44 .size foo, 4