1// REQUIRES: x86 2// RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o 3// RUN: ld.lld -static %t.o -o %tout 4// RUN: llvm-objdump -d --no-show-raw-insn %tout | FileCheck %s --check-prefix=DISASM 5// RUN: llvm-readobj -r --symbols --sections %tout | FileCheck %s 6 7// CHECK: Sections [ 8// CHECK: Section { 9// CHECK: Index: 1 10// CHECK-NEXT: Name: .rel.dyn 11// CHECK-NEXT: Type: SHT_REL 12// CHECK-NEXT: Flags [ 13// CHECK-NEXT: SHF_ALLOC 14// CHECK-NEXT: SHF_INFO_LINK 15// CHECK-NEXT: ] 16// CHECK-NEXT: Address: [[RELA:.*]] 17// CHECK-NEXT: Offset: 0xD4 18// CHECK-NEXT: Size: 16 19// CHECK-NEXT: Link: 0 20// CHECK-NEXT: Info: 4 21// CHECK-NEXT: AddressAlignment: 4 22// CHECK-NEXT: EntrySize: 8 23// CHECK-NEXT: } 24// CHECK: Relocations [ 25// CHECK-NEXT: Section ({{.*}}) .rel.dyn { 26// CHECK-NEXT: 0x402120 R_386_IRELATIVE 27// CHECK-NEXT: 0x402124 R_386_IRELATIVE 28// CHECK-NEXT: } 29// CHECK-NEXT: ] 30 31// CHECK: Symbols [ 32// CHECK-NEXT: Symbol { 33// CHECK-NEXT: Name: 34// CHECK-NEXT: Value: 0x0 35// CHECK-NEXT: Size: 0 36// CHECK-NEXT: Binding: Local 37// CHECK-NEXT: Type: None 38// CHECK-NEXT: Other: 0 39// CHECK-NEXT: Section: Undefined 40// CHECK-NEXT: } 41// CHECK-NEXT: Symbol { 42// CHECK-NEXT: Name: __rel_iplt_end 43// CHECK-NEXT: Value: 0x4000E4 44// CHECK-NEXT: Size: 0 45// CHECK-NEXT: Binding: Local 46// CHECK-NEXT: Type: None 47// CHECK-NEXT: Other [ 48// CHECK-NEXT: STV_HIDDEN 49// CHECK-NEXT: ] 50// CHECK-NEXT: Section: .rel.dyn 51// CHECK-NEXT: } 52// CHECK-NEXT: Symbol { 53// CHECK-NEXT: Name: __rel_iplt_start 54// CHECK-NEXT: Value: [[RELA]] 55// CHECK-NEXT: Size: 0 56// CHECK-NEXT: Binding: Local 57// CHECK-NEXT: Type: None 58// CHECK-NEXT: Other [ 59// CHECK-NEXT: STV_HIDDEN 60// CHECK-NEXT: ] 61// CHECK-NEXT: Section: .rel.dyn 62// CHECK-NEXT: } 63// CHECK-NEXT: Symbol { 64// CHECK-NEXT: Name: _start 65// CHECK-NEXT: Value: 0x4010E6 66// CHECK-NEXT: Size: 0 67// CHECK-NEXT: Binding: Global 68// CHECK-NEXT: Type: None 69// CHECK-NEXT: Other: 0 70// CHECK-NEXT: Section: .text 71// CHECK-NEXT: } 72// CHECK-NEXT: Symbol { 73// CHECK-NEXT: Name: bar 74// CHECK-NEXT: Value: 0x401110 75// CHECK-NEXT: Size: 0 76// CHECK-NEXT: Binding: Global 77// CHECK-NEXT: Type: Function 78// CHECK-NEXT: Other: 0 79// CHECK-NEXT: Section: .iplt 80// CHECK-NEXT: } 81// CHECK-NEXT: Symbol { 82// CHECK-NEXT: Name: bar_resolver 83// CHECK-NEXT: Value: 0x4010E5 84// CHECK-NEXT: Size: 0 85// CHECK-NEXT: Binding: Global 86// CHECK-NEXT: Type: Function 87// CHECK-NEXT: Other: 0 88// CHECK-NEXT: Section: .text 89// CHECK-NEXT: } 90// CHECK-NEXT: Symbol { 91// CHECK-NEXT: Name: foo 92// CHECK-NEXT: Value: 0x401100 93// CHECK-NEXT: Size: 0 94// CHECK-NEXT: Binding: Global 95// CHECK-NEXT: Type: Function 96// CHECK-NEXT: Other: 0 97// CHECK-NEXT: Section: .iplt 98// CHECK-NEXT: } 99// CHECK-NEXT: Symbol { 100// CHECK-NEXT: Name: foo_resolver 101// CHECK-NEXT: Value: 0x4010E4 102// CHECK-NEXT: Size: 0 103// CHECK-NEXT: Binding: Global 104// CHECK-NEXT: Type: Function 105// CHECK-NEXT: Other: 0 106// CHECK-NEXT: Section: .text 107// CHECK-NEXT: } 108// CHECK-NEXT:] 109 110// DISASM: Disassembly of section .text: 111// DISASM-EMPTY: 112// DISASM-NEXT: <foo_resolver>: 113// DISASM-NEXT: 4010e4: retl 114// DISASM: <bar_resolver>: 115// DISASM-NEXT: 4010e5: retl 116// DISASM: <_start>: 117// DISASM-NEXT: 4010e6: calll 0x401100 <foo> 118// DISASM-NEXT: calll 0x401110 <bar> 119// DISASM-NEXT: movl $4194516, %edx 120// DISASM-NEXT: movl $4194532, %edx 121// DISASM-EMPTY: 122// DISASM-NEXT: Disassembly of section .iplt: 123// DISASM-EMPTY: 124// DISASM-NEXT: <foo>: 125// DISASM-NEXT: 401100: jmpl *4202784 126// DISASM-NEXT: pushl $0 127// DISASM-NEXT: jmp 0x0 128// DISASM: <bar>: 129// DISASM-NEXT: 401110: jmpl *4202788 130// DISASM-NEXT: pushl $8 131// DISASM-NEXT: jmp 0x0 132 133.text 134.type foo STT_GNU_IFUNC 135.globl foo 136foo: 137.type foo_resolver STT_FUNC 138.globl foo_resolver 139foo_resolver: 140 ret 141 142.type bar STT_GNU_IFUNC 143.globl bar 144bar: 145.type bar_resolver STT_FUNC 146.globl bar_resolver 147bar_resolver: 148 ret 149 150.globl _start 151_start: 152 call foo 153 call bar 154 movl $__rel_iplt_start,%edx 155 movl $__rel_iplt_end,%edx 156