File: gnu-ifunc-noplt-i386.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (71 lines) | stat: -rw-r--r-- 2,079 bytes parent folder | download | duplicates (21)
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
// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=i686-pc-freebsd %S/Inputs/shared2-x86-64.s -o %t1.o
// RUN: ld.lld %t1.o --shared --soname=t.so -o %t.so
// RUN: llvm-mc -filetype=obj -triple=i686-pc-freebsd %s -o %t.o
// RUN: ld.lld -z ifunc-noplt -z notext --hash-style=sysv %t.so %t.o -o %tout
// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %tout | FileCheck %s --check-prefix=DISASM
// RUN: llvm-readobj -r --dynamic-table %tout | FileCheck %s

// Check that we emitted relocations for the ifunc calls
// CHECK: Relocations [
// CHECK-NEXT:   Section (4) .rel.dyn {
// CHECK-NEXT:     0x4011EF R_386_PLT32 foo
// CHECK-NEXT:     0x4011F4 R_386_PLT32 bar
// CHECK-NEXT:   }
// CHECK-NEXT:   Section (5) .rel.plt {
// CHECK-NEXT:     0x4032D4 R_386_JUMP_SLOT bar2
// CHECK-NEXT:     0x4032D8 R_386_JUMP_SLOT zed2
// CHECK-NEXT:   }

// Check that ifunc call sites still require relocation
// DISASM: Disassembly of section .text:
// DISASM-EMPTY:
// DISASM-NEXT: 004011ec <foo>:
// DISASM-NEXT:   retl
// DISASM-EMPTY:
// DISASM-NEXT: 004011ed <bar>:
// DISASM-NEXT:   retl
// DISASM-EMPTY:
// DISASM-NEXT: 004011ee <_start>:
// DISASM-NEXT:   calll	0x4011ef <_start+0x1>
// DISASM-NEXT:   calll	0x4011f4 <_start+0x6>
// DISASM-NEXT:   calll	0x401220 <bar2@plt>
// DISASM-NEXT:   calll	0x401230 <zed2@plt>
// DISASM-EMPTY:
// DISASM-NEXT: Disassembly of section .plt:
// DISASM-EMPTY:
// DISASM-NEXT: 00401210 <.plt>:
// DISASM-NEXT:   pushl 0x4032cc
// DISASM-NEXT:   jmpl *0x4032d0
// DISASM-NEXT:   nop
// DISASM-NEXT:   nop
// DISASM-NEXT:   nop
// DISASM-NEXT:   nop
// DISASM-EMPTY:
// DISASM-NEXT: 00401220 <bar2@plt>:
// DISASM-NEXT:   jmpl	*0x4032d4
// DISASM-NEXT:   pushl	$0x0
// DISASM-NEXT:   jmp	0x401210 <.plt>
// DISASM-EMPTY:
// DISASM-NEXT: 00401230 <zed2@plt>:
// DISASM-NEXT:   jmpl	*0x4032d8
// DISASM-NEXT:   pushl	$0x8
// DISASM-NEXT:   jmp	0x401210 <.plt>

.text
.type foo STT_GNU_IFUNC
.globl foo
foo:
 ret

.type bar STT_GNU_IFUNC
.globl bar
bar:
 ret

.globl _start
_start:
 call foo@plt
 call bar@plt
 call bar2@plt
 call zed2@plt