2 # RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.o
3 # RUN: echo '.globl b; b:' | llvm-mc -filetype=obj -triple=powerpc - -o %t1.o
4 # RUN: ld.lld -shared %t1.o -soname=t1.so -o %t1.so
6 # RUN: ld.lld %t.o %t1.so -o %t
7 # RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
8 # RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
9 # RUN: llvm-readobj -x .got %t | FileCheck --check-prefix=HEX %s
10 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
12 ## Check we can handle R_PPC_GOT16, which may be generated by -fpic code.
15 # RELOC-NEXT: 0x10020218 R_PPC_GLOB_DAT b 0x0
18 # NM: 1002020c d _GLOBAL_OFFSET_TABLE_
21 ## The GOT slot of a can be filled at link time.
22 # HEX: section '.got':
23 # HEX: 0x1002020c [[#%x,]] 00000000 00000000 00000000
24 # HEX-NEXT: 0x1002021c 10030220
26 ## a: &.got[4] - _GLOBAL_OFFSET_TABLE_ = 0x1002021c - 0x1002020c = 16
27 ## b: &.got[3] - _GLOBAL_OFFSET_TABLE_ = 0x10020218 - 0x1002020c = 12
28 # CHECK: lwz 3, 16(30)
29 # CHECK: lwz 4, 12(30)
36 .long _GLOBAL_OFFSET_TABLE_