brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 23b763a Raw
70 lines · plain
1# REQUIRES: riscv2# RUN: echo '.globl b; b:' | llvm-mc -filetype=obj -triple=riscv32 - -o %t1.o3# RUN: ld.lld -shared %t1.o -soname=t1.so -o %t1.so4 5# RUN: llvm-mc -filetype=obj -triple=riscv32 -position-independent %s -o %t.o6# RUN: ld.lld %t.o %t1.so -o %t7# RUN: llvm-readelf -S %t | FileCheck --check-prefix=SEC32 %s8# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC32 %s9# RUN: llvm-nm %t | FileCheck --check-prefix=NM32 %s10# RUN: llvm-readobj -x .got %t | FileCheck --check-prefix=HEX32 %s11# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DIS32 %s12 13# RUN: echo '.globl b; b:' | llvm-mc -filetype=obj -triple=riscv64 - -o %t1.o14# RUN: ld.lld -shared %t1.o -soname=t1.so -o %t1.so15 16# RUN: llvm-mc -filetype=obj -triple=riscv64 -position-independent %s -o %t.o17# RUN: ld.lld %t.o %t1.so -o %t18# RUN: llvm-readelf -S %t | FileCheck --check-prefix=SEC64 %s19# RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC64 %s20# RUN: llvm-nm %t | FileCheck --check-prefix=NM64 %s21# RUN: llvm-readobj -x .got %t | FileCheck --check-prefix=HEX64 %s22# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DIS64 %s23 24# SEC32: .got PROGBITS         0001220c 00020c 00000c25# SEC64: .got PROGBITS 0000000000012358 000358 00001826 27# RELOC32:      .rela.dyn {28# RELOC32-NEXT:   0x12210 R_RISCV_32 b 0x029# RELOC32-NEXT: }30 31# RELOC64:      .rela.dyn {32# RELOC64-NEXT:   0x12360 R_RISCV_64 b 0x033# RELOC64-NEXT: }34 35# NM32: 00013218 d a36# NM64: 0000000000013370 d a37 38## .got[0] = _DYNAMIC39## .got[1] = 0 (relocated by R_RISCV_32/64 at runtime)40## .got[2] = a (filled at link time)41# HEX32: section '.got':42# HEX32: 0x0001220c ac210100 00000000 18320100 43 44# HEX64: section '.got':45# HEX64: 0x00012358 98220100 00000000 00000000 0000000046# HEX64: 0x00012368 70330100 0000000047 48## &.got[2]-. = 0x12214-0x1119c = 4096*1+12049# DIS32:      1119c: auipc a0, 0x150# DIS32-NEXT:        lw a0, 0x78(a0)51## &.got[1]-. = 0x12210-0x111a4 = 4096*1+10852# DIS32:      111a4: auipc a0, 0x153# DIS32-NEXT:        lw a0, 0x6c(a0)54 55## &.got[2]-. = 0x12368-0x11288 = 4096*1+22456# DIS64:      11288: auipc a0, 0x157# DIS64-NEXT:        ld a0, 0xe0(a0)58## &.got[1]-. = 0x12360-0x11290 = 4096*1+20859# DIS64:      11290: auipc a0, 0x160# DIS64-NEXT:        ld a0, 0xd0(a0)61 62la a0,a63la a0,b64 65.data66a:67## An undefined reference of _GLOBAL_OFFSET_TABLE_ causes .got[0] to be68## allocated to store _DYNAMIC.69.long _GLOBAL_OFFSET_TABLE_ - .70