1# REQUIRES: ppc 2## Test .got2 placed in a different output section. 3 4# RUN: rm -rf %t && split-file %s %t 5# RUN: llvm-mc -filetype=obj -triple=powerpc %t/a.s -o %t/a.o 6# RUN: llvm-mc -filetype=obj -triple=powerpc %t/b.s -o %t/b.o 7# RUN: ld.lld -shared -T %t/t %t/a.o %t/b.o -o %t/a.so 8# RUN: llvm-readobj -r %t/a.so | FileCheck --check-prefix=RELOC %s 9# RUN: llvm-readelf -S %t/a.so | FileCheck --check-prefix=SEC %s 10 11# RELOC: .rela.plt { 12# RELOC-NEXT: 0x1A4 R_PPC_JMP_SLOT f 0x0 13# RELOC-NEXT: } 14 15# SEC: .got PROGBITS 0000018c 16# SEC-NEXT: .rodata PROGBITS 00000198 17 18## .got2+0x8000-0xb0 = .rodata+4+0x8000-0xb0 = 0x198+4+0x8000-0xb0 = 65536*1-32532 19# CHECK: <_start>: 20# CHECK-NEXT: bcl 20, 31, 0x 21# CHECK-NEXT: b0: mflr 30 22# CHECK-NEXT: addis 30, 30, 1 23# CHECK-NEXT: addi 30, 30, -32532 24# CHECK-NEXT: bl {{.*}} <00008000.got2.plt_pic32.f> 25 26## &.got[2] - (.got2+0x8000) = &.got[2] - (.rodata+4+0x8000) = 0x1A4 - (0x198+4+0x8000) = -32760 27# CHECK: <00008000.got2.plt_pic32.f>: 28# CHECK-NEXT: lwz 11, -32760(30) 29# CHECK-NEXT: mtctr 11 30# CHECK-NEXT: bctr 31# CHECK-NEXT: nop 32 33#--- a.s 34.section .rodata.cst4,"aM",@progbits,4 35.long 1 36 37.section .got2,"aw" 38.long f 39 40.text 41.globl _start, f, g 42_start: 43 bcl 20,31,.L 44.L: 45 mflr 30 46 addis 30, 30, .got2+0x8000-.L@ha 47 addi 30, 30, .got2+0x8000-.L@l 48 bl f+0x8000@plt 49 50#--- b.s 51.section .got2,"aw" 52.globl f 53f: 54 bl f+0x8000@plt 55 56#--- t 57SECTIONS { 58 .rodata : { *(.rodata .rodata.*) *(.got2) } 59} 60