120 lines · plain
1# REQUIRES: mips2# Check MIPS multi-GOT layout.3 4# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t0.o5# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \6# RUN: %p/Inputs/mips-mgot-1.s -o %t1.o7# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \8# RUN: %p/Inputs/mips-mgot-2.s -o %t2.o9# RUN: echo "SECTIONS { \10# RUN: . = 0x10000; .text : { *(.text) } \11# RUN: . = 0x70000; .got : { *(.got) } \12# RUN: }" > %t.script13# RUN: ld.lld -shared -mips-got-size 52 --script %t.script %t0.o %t1.o %t2.o -o %t.so14# RUN: llvm-objdump -s --section=.got -t %t.so | FileCheck %s15# RUN: llvm-readobj -r --dyn-syms -A %t.so | FileCheck -check-prefix=GOT %s16 17# CHECK: SYMBOL TABLE:18# CHECK: 00000000 l .tdata 00000000 loc019# CHECK: [[FOO0:[0-9a-f]+]] g .text 00000000 foo020# CHECK: 00000000 g .tdata 00000000 tls021# CHECK: 00000004 g .tdata 00000000 tls122# CHECK: [[FOO2:[0-9a-f]+]] g .text 00000000 foo223 24# CHECK: Contents of section .got:25# CHECK-NEXT: 70000 00000000 80000000 [[FOO0]] [[FOO2]]26# CHECK-NEXT: 70010 00000000 00000004 00010000 0002000027# CHECK-NEXT: 70020 00030000 00040000 00050000 0006000028# CHECK-NEXT: 70030 00000000 00000000 00000000 0000000029# CHECK-NEXT: 70040 00000000 00000000 0000000030 31# GOT: Relocations [32# GOT-NEXT: Section (7) .rel.dyn {33# GOT-NEXT: 0x70018 R_MIPS_REL32 -34# GOT-NEXT: 0x7001C R_MIPS_REL32 -35# GOT-NEXT: 0x70020 R_MIPS_REL32 -36# GOT-NEXT: 0x70024 R_MIPS_REL32 -37# GOT-NEXT: 0x70028 R_MIPS_REL32 -38# GOT-NEXT: 0x7002C R_MIPS_REL32 -39# GOT-NEXT: 0x70030 R_MIPS_REL32 foo040# GOT-NEXT: 0x70034 R_MIPS_REL32 foo241# GOT-NEXT: 0x70044 R_MIPS_TLS_DTPMOD32 -42# GOT-NEXT: 0x70010 R_MIPS_TLS_TPREL32 tls043# GOT-NEXT: 0x70038 R_MIPS_TLS_TPREL32 tls044# GOT-NEXT: 0x7003C R_MIPS_TLS_DTPMOD32 tls045# GOT-NEXT: 0x70040 R_MIPS_TLS_DTPREL32 tls046# GOT-NEXT: 0x70014 R_MIPS_TLS_TPREL32 tls147# GOT-NEXT: }48# GOT-NEXT: ]49 50# GOT: DynamicSymbols [51# GOT: Symbol {52# GOT: Name: foo053# GOT-NEXT: Value: 0x[[FOO0:[0-9A-F]+]]54# GOT: }55# GOT-NEXT: Symbol {56# GOT-NEXT: Name: foo257# GOT-NEXT: Value: 0x[[FOO2:[0-9A-F]+]]58# GOT: }59# GOT-NEXT: ]60 61# GOT: Primary GOT {62# GOT-NEXT: Canonical gp value: 0x77FF063# GOT-NEXT: Reserved entries [64# GOT-NEXT: Entry {65# GOT-NEXT: Address:66# GOT-NEXT: Access: -3275267# GOT-NEXT: Initial: 0x068# GOT-NEXT: Purpose: Lazy resolver69# GOT-NEXT: }70# GOT-NEXT: Entry {71# GOT-NEXT: Address:72# GOT-NEXT: Access: -3274873# GOT-NEXT: Initial: 0x8000000074# GOT-NEXT: Purpose: Module pointer (GNU extension)75# GOT-NEXT: }76# GOT-NEXT: ]77# GOT-NEXT: Local entries [78# GOT-NEXT: ]79# GOT-NEXT: Global entries [80# GOT-NEXT: Entry {81# GOT-NEXT: Address:82# GOT-NEXT: Access: -3274483# GOT-NEXT: Initial: 0x[[FOO0]]84# GOT-NEXT: Value: 0x[[FOO0]]85# GOT-NEXT: Type: None86# GOT-NEXT: Section: .text87# GOT-NEXT: Name: foo088# GOT-NEXT: }89# GOT-NEXT: Entry {90# GOT-NEXT: Address:91# GOT-NEXT: Access: -3274092# GOT-NEXT: Initial: 0x[[FOO2]]93# GOT-NEXT: Value: 0x[[FOO2]]94# GOT-NEXT: Type: None95# GOT-NEXT: Section: .text96# GOT-NEXT: Name: foo297# GOT-NEXT: }98# GOT-NEXT: ]99# GOT-NEXT: Number of TLS and multi-GOT entries: 15100# GOT-NEXT: }101 102 .text103 .global foo0104foo0:105 lw $2, %got(.data)($gp) # page entry106 addi $2, $2, %lo(.data)107 lw $2, %call16(foo0)($gp) # global entry108 addiu $2, $2, %tlsgd(tls0) # tls gd entry109 addiu $2, $2, %gottprel(tls0) # tls got entry110 addiu $2, $2, %tlsldm(loc0) # tls ld entry111 112 .data113 .space 0x20000114 115 .section .tdata,"awT",%progbits116 .global tls0117tls0:118loc0:119 .word 0120