[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / copy-rel-alias.s
blob08b7aed6a9228a5d16fdfdb61e66120a1726847a
1 # REQUIRES: x86
2 # RUN: rm -rf %t && split-file %s %t
3 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/1.s -o %t/1.o
4 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/2.s -o %t/2.o
5 # RUN: ld.lld -shared -soname=t2 %t/2.o -o %t/2.so
6 # RUN: ld.lld %t/1.o %t/2.so -o %t/1
7 # RUN: llvm-readelf -S -r --dyn-syms %t/1 | FileCheck %s
8 # RUN: ld.lld --gc-sections -pie %t/1.o %t/2.so -o %t/1
9 # RUN: llvm-readelf -S -r --dyn-syms %t/1 | FileCheck %s
11 # CHECK: [[#BSS:]]] .bss
13 # CHECK: R_X86_64_COPY [[#%x,]] a1 + 0
14 # CHECK-NEXT: R_X86_64_GLOB_DAT [[#%x,]] b1 + 0
15 # CHECK-NEXT: R_X86_64_COPY [[#%x,]] b1 + 0
16 # CHECK-NEXT: R_X86_64_GLOB_DAT [[#%x,]] a2 + 0
18 # CHECK: Value Size Type Bind Vis Ndx Name
19 # CHECK: [[#%x,ADDR:]] 1 OBJECT GLOBAL DEFAULT [[#BSS]] a1
20 # CHECK-NEXT: {{0*}}[[#ADDR+1]] 1 OBJECT WEAK DEFAULT [[#BSS]] b1
21 # CHECK-NEXT: {{0*}}[[#ADDR+1]] 1 OBJECT GLOBAL DEFAULT [[#BSS]] b2
22 # CHECK-NEXT: {{0*}}[[#ADDR]] 1 OBJECT WEAK DEFAULT [[#BSS]] a2
23 # CHECK-NEXT: {{0*}}[[#ADDR+1]] 1 OBJECT GLOBAL DEFAULT [[#BSS]] b3
25 #--- 1.s
26 .global _start
27 _start:
28 movl $5, a1
29 mov $b1 - ., %eax
30 mov $b2 - ., %eax
32 ## Test that a copy relocated alias may have GOT entry.
33 .weak a2, b1
34 movq a2@gotpcrel(%rip), %rax
35 movq b1@gotpcrel(%rip), %rcx
37 #--- 2.s
38 .data
40 .globl a1, b3
41 .weak a2, b1, b2
43 .type a1, @object
44 .type a2, @object
45 a1:
46 a2:
47 .byte 1
48 .size a1, 1
49 .size a2, 1
51 .type b1, @object
52 .type b2, @object
53 .type b3, @object
54 b1:
55 b2:
56 b3:
57 .byte 2
58 .size b1, 1
59 .size b2, 1
60 .size b3, 1