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 10 11# CHECK: [[#BSS:]]] .bss 12 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 17 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 24 25#--- 1.s 26.global _start 27_start: 28movl $5, a1 29mov $b1 - ., %eax 30mov $b2 - ., %eax 31 32## Test that a copy relocated alias may have GOT entry. 33.weak a2, b1 34movq a2@gotpcrel(%rip), %rax 35movq b1@gotpcrel(%rip), %rcx 36 37#--- 2.s 38.data 39 40.globl a1, b3 41.weak a2, b1, b2 42 43.type a1, @object 44.type a2, @object 45a1: 46a2: 47.byte 1 48.size a1, 1 49.size a2, 1 50 51.type b1, @object 52.type b2, @object 53.type b3, @object 54b1: 55b2: 56b3: 57.byte 2 58.size b1, 1 59.size b2, 1 60.size b3, 1 61