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

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-16
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,496,368 kB
  • sloc: cpp: 5,593,980; ansic: 986,873; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,547; xml: 953; cs: 573; fortran: 567
file content (39 lines) | stat: -rw-r--r-- 1,304 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
// 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 -d --start-address=0x2020 --stop-address=0x202c --no-show-raw-insn %t2 | FileCheck --check-prefix=CHECK-PLT %s
// RUN: llvm-objdump -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