41 lines · plain
1# REQUIRES: riscv2# RUN: llvm-mc -filetype=obj -triple=riscv32 %s -o %t.32.o3# RUN: ld.lld -pie %t.32.o -o %t.324# RUN: llvm-readelf -S -s %t.32 | FileCheck --check-prefix=SEC32 %s5# RUN: not ld.lld -shared %t.32.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s6 7# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.64.o8# RUN: ld.lld -pie %t.64.o -o %t.649# RUN: llvm-readelf -S -s %t.64 | FileCheck --check-prefix=SEC64 %s10# RUN: not ld.lld -shared %t.64.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s11 12## __global_pointer$ = .sdata+0x800 = 0x39c013# SEC32: [ [[#SDATA:]]] .sdata PROGBITS {{0*}}000031c014# SEC32: {{0*}}000039c0 0 NOTYPE GLOBAL DEFAULT [[#SDATA]] __global_pointer$15 16# SEC64: [ [[#SDATA:]]] .sdata PROGBITS {{0*}}000032e017# SEC64: '.dynsym'18# SEC64-NOT: __global_pointer$19# SEC64: '.symtab'20# SEC64: {{0*}}00003ae0 0 NOTYPE GLOBAL DEFAULT [[#SDATA]] __global_pointer$21 22# ERR: error: relocation R_RISCV_PCREL_HI20 cannot be used against symbol '__global_pointer$'; recompile with -fPIC23 24# RUN: ld.lld -pie --no-dynamic-linker --export-dynamic %t.64.o -o %t.64e25# RUN: llvm-readelf -s %t.64e | FileCheck %s --check-prefix=STATICE26 27# STATICE: '.dynsym'28# STATICE: __global_pointer$29# STATICE: '.symtab'30# STATICE: __global_pointer$31 32## -r mode does not define __global_pointer$.33# RUN: ld.lld -r %t.64.o -o %t.64.ro34# RUN: llvm-readelf -s %t.64.ro | FileCheck --check-prefix=RELOCATABLE %s35 36# RELOCATABLE: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __global_pointer$37 38lla gp, __global_pointer$39 40.section .sdata,"aw"41