File: arm-fix-cortex-a8-plt.s

package info (click to toggle)
swiftlang 6.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,604 kB
  • sloc: cpp: 9,901,740; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (39 lines) | stat: -rw-r--r-- 1,342 bytes parent folder | download | duplicates (17)
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
// REQUIRES: arm
// RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabihf --arm-add-build-attributes %s -o %t.o
// RUN: echo "SECTIONS { \
// RUN:       .plt  0x2000 : { *(.plt) *(.plt.*) } \
// RUN:       .text : { *(.text) } \
// RUN:       }" > %t.script

// RUN: ld.lld --script %t.script --fix-cortex-a8 --shared -verbose %t.o -o %t2
// RUN: llvm-objdump --no-print-imm-hex -d --start-address=0x2020 --stop-address=0x202c --no-show-raw-insn %t2 | FileCheck --check-prefix=CHECK-PLT %s
// RUN: llvm-objdump --no-print-imm-hex -d --start-address=0x2ffa --stop-address=0x3008 --no-show-raw-insn %t2 | FileCheck %s

/// If we patch a branch instruction that is indirected via the PLT then we
/// must make sure the patch goes via the PLT

// CHECK-PLT:          2020:            add     r12, pc, #0, #12
// CHECK-PLT-NEXT:     2024:            add     r12, r12, #4096
// CHECK-PLT-NEXT:     2028:            ldr     pc, [r12, #68]!

 .syntax unified
 .thumb

 .global external
 .type external, %function

 .text
 .balign 2048

 .space 2042
 .global source
 .thumb_func
source:
 nop.w
 bl external

// CHECK:      00002ffa <source>:
// CHECK-NEXT:     2ffa:        nop.w
// CHECK-NEXT:     2ffe:        blx     0x3004 <__CortexA8657417_2FFE>
// CHECK:      00003004 <__CortexA8657417_2FFE>:
// CHECK-NEXT:     3004:        b       0x2020