1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
# REQUIRES: mips
# Check R_MIPS_GOT16 relocation against weak symbols.
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
# RUN: ld.lld %t.o -shared -o %t1.so
# RUN: llvm-readobj -r --dyn-syms --dynamic-table --mips-plt-got %t1.so \
# RUN: | FileCheck -check-prefixes=CHECK,NOSYM %s
# RUN: ld.lld %t.o -shared -Bsymbolic -o %t2.so
# RUN: llvm-readobj -r --dyn-syms --dynamic-table --mips-plt-got %t2.so \
# RUN: | FileCheck -check-prefixes=CHECK,SYM %s
# CHECK: Relocations [
# CHECK-NEXT: ]
# NOSYM: Symbol {
# NOSYM: Name: foo
# NOSYM-NEXT: Value: 0x20000
# NOSYM-NEXT: Size: 0
# NOSYM-NEXT: Binding: Weak
# NOSYM-NEXT: Type: None
# NOSYM-NEXT: Other: 0
# NOSYM-NEXT: Section: .data
# NOSYM-NEXT: }
# CHECK: Symbol {
# CHECK: Name: bar
# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Weak
# CHECK-NEXT: Type: None
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined
# CHECK-NEXT: }
# NOSYM: Symbol {
# NOSYM: Name: sym
# NOSYM-NEXT: Value: 0x20004
# NOSYM-NEXT: Size: 0
# NOSYM-NEXT: Binding: Global
# NOSYM-NEXT: Type: None
# NOSYM-NEXT: Other: 0
# NOSYM-NEXT: Section: .data
# NOSYM-NEXT: }
# CHECK: 0x70000011 MIPS_SYMTABNO 4
# SYM: 0x7000000A MIPS_LOCAL_GOTNO 4
# SYM: 0x70000013 MIPS_GOTSYM 0x3
# NOSYM: 0x7000000A MIPS_LOCAL_GOTNO 2
# NOSYM: 0x70000013 MIPS_GOTSYM 0x1
# CHECK: Primary GOT {
# CHECK-NEXT: Canonical gp value:
# CHECK-NEXT: Reserved entries [
# CHECK: ]
# SYM: Local entries [
# SYM-NEXT: Entry {
# SYM-NEXT: Address:
# SYM-NEXT: Access: -32744
# SYM-NEXT: Initial: 0x20000
# SYM-NEXT: }
# SYM-NEXT: Entry {
# SYM-NEXT: Address:
# SYM-NEXT: Access: -32740
# SYM-NEXT: Initial: 0x20004
# SYM-NEXT: }
# SYM-NEXT: ]
# NOSYM: Local entries [
# NOSYM-NEXT: ]
# SYM-NEXT: Global entries [
# SYM-NEXT: Entry {
# SYM-NEXT: Address:
# SYM-NEXT: Access: -32736
# SYM-NEXT: Initial: 0x0
# SYM-NEXT: Value: 0x0
# SYM-NEXT: Type: None
# SYM-NEXT: Section: Undefined
# SYM-NEXT: Name: bar
# SYM-NEXT: }
# SYM-NEXT: ]
# NOSYM-NEXT: Global entries [
# NOSYM-NEXT: Entry {
# NOSYM-NEXT: Address:
# NOSYM-NEXT: Access: -32744
# NOSYM-NEXT: Initial: 0x20000
# NOSYM-NEXT: Value: 0x20000
# NOSYM-NEXT: Type: None
# NOSYM-NEXT: Section: .data
# NOSYM-NEXT: Name: foo
# NOSYM-NEXT: }
# NOSYM-NEXT: Entry {
# NOSYM-NEXT: Address:
# NOSYM-NEXT: Access: -32740
# NOSYM-NEXT: Initial: 0x0
# NOSYM-NEXT: Value: 0x0
# NOSYM-NEXT: Type: None
# NOSYM-NEXT: Section: Undefined
# NOSYM-NEXT: Name: bar
# NOSYM-NEXT: }
# NOSYM-NEXT: Entry {
# NOSYM-NEXT: Address:
# NOSYM-NEXT: Access: -32736
# NOSYM-NEXT: Initial: 0x20004
# NOSYM-NEXT: Value: 0x20004
# NOSYM-NEXT: Type: None
# NOSYM-NEXT: Section: .data
# NOSYM-NEXT: Name: sym
# NOSYM-NEXT: }
# NOSYM-NEXT: ]
# CHECK: Number of TLS and multi-GOT entries: 0
# CHECK-NEXT: }
.text
.global sym
.weak foo,bar
func:
lw $t0,%got(foo)($gp)
lw $t0,%got(bar)($gp)
lw $t0,%got(sym)($gp)
.data
.weak foo
foo:
.word 0
sym:
.word 0
|