1# REQUIRES: ppc 2 3# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o 4# RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=INPUT-REL %s 5# RUN: llvm-objdump -d --no-show-raw-insn %t.o | FileCheck --check-prefix=INPUT-ASM %s 6 7# RUN: ld.lld --shared %t.o --soname=t.so -o %t.so 8# RUN: llvm-readelf -r %t.so | FileCheck --check-prefix=SO-REL %s 9# RUN: llvm-readelf -x .got %t.so | FileCheck --check-prefix=SO-GOT %s 10# RUN: llvm-readelf -s %t.so | FileCheck --check-prefix=SO-SYM %s 11 12## Test to make sure that the first element of a GOT section is the tocbase .TOC. 13 14# INPUT-REL: Section (3) .rela.text { 15# INPUT-REL-NEXT: 0x0 R_PPC64_GOT_PCREL34 glob_int 0x0 16# INPUT-REL-NEXT: 0x0 R_PPC64_PCREL_OPT - 0x8 17# INPUT-REL-NEXT: } 18 19# INPUT-ASM-LABEL: <test>: 20# INPUT-ASM: pld 3, 0(0), 1 21# INPUT-ASM-NEXT: lwa 3, 0(3) 22# INPUT-ASM-NEXT: blr 23 24# SO-REL: Relocation section '.rela.dyn' 25# SO-REL: 0000000000020390 0000000100000014 R_PPC64_GLOB_DAT 00000000000102d0 glob_int + 0 26 27# SO-GOT: Hex dump of section '.got': 28# SO-GOT: 0x00020388 88830200 00000000 00000000 00000000 29 30# SO-SYM: Symbol table '.symtab' contains 4 entries: 31# SO-SYM: 3: 00000000000102d0 4 NOTYPE GLOBAL DEFAULT 6 glob_int 32 33test: 34 pld 3, glob_int@got@pcrel(0), 1 35.Lpcrel0: 36 .reloc .Lpcrel0-8,R_PPC64_PCREL_OPT,.-(.Lpcrel0-8) 37 lwa 3, 0(3) 38 blr 39 40 .globl glob_int 41 .p2align 2 42glob_int: 43 .long 0 44 .size glob_int, 4 45