File: mips-micro-plt.s

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (58 lines) | stat: -rw-r--r-- 2,035 bytes parent folder | download | duplicates (7)
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
# REQUIRES: mips
# Check less-significant bit setup for microMIPS PLT.

# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
# RUN:         -mattr=micromips %S/Inputs/mips-dynamic.s -o %t-dso.o
# RUN: ld.lld %t-dso.o -shared -soname=t.so -o %t.so
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
# RUN:         -mattr=micromips %s -o %t-exe.o
# RUN: echo "SECTIONS { \
# RUN:         . = 0x20000;  .text ALIGN(0x100) : { *(.text) } \
# RUN:         . = 0x20300;  .plt : { *(.plt) } \
# RUN:       }" > %t.script
# RUN: ld.lld %t-exe.o %t.so --script %t.script -o %t.exe
# RUN: llvm-readelf --symbols --dyn-syms -A %t.exe | FileCheck %s
# RUN: llvm-objdump -d --mattr=micromips --no-show-raw-insn %t.exe \
# RUN:   | FileCheck --check-prefix=ASM %s

# CHECK: Symbol table '.dynsym'
# CHECK:    Num:    Value  Size Type    Bind   Vis                    Ndx Name
# CHECK:      1: 00020321     0 FUNC    GLOBAL DEFAULT [<other: 0x88>] UND foo0

# CHECK: Symbol table '.symtab'
# CHECK:    Num:    Value  Size Type    Bind   Vis                    Ndx Name
# CHECK:      1: 00020210     0 NOTYPE  LOCAL  HIDDEN [<other: 0x82>]   8 foo
# CHECK:      4: 00020200     0 NOTYPE  GLOBAL DEFAULT [<other: 0x80>]   8 __start
# CHECK:      5: 00020320     0 FUNC    GLOBAL DEFAULT [<other: 0x88>] UND foo0

# CHECK: Primary GOT:
# CHECK:  Local entries:
# CHECK:    Address     Access  Initial
# CHECK:            -32744(gp) 00020211

# CHECK: PLT GOT:
# CHECK:  Entries:
# CHECK:    Address  Initial Sym.Val. Type    Ndx Name
# CHECK:            00020301 00020321 FUNC    UND foo0

# ASM:      <__start>:
# ASM-NEXT:    20200:  lw      $8, -32744($gp)
# ASM-NEXT:            addi    $8, $8, 529
# ASM-NEXT:            lui     $8, 2
# ASM-NEXT:            addi    $8, $8, 801
#
# ASM:      <foo>:
# ASM-NEXT:    20210:  jal     131872

  .text
  .set micromips
  .global foo
  .hidden foo
  .global __start
__start:
  lw    $t0,%got(foo)($gp)
  addi  $t0,$t0,%lo(foo)
  lui   $t0,%hi(foo0)
  addi  $t0,$t0,%lo(foo0)
foo:
  jal   foo0