File: arm-fix-cortex-a8-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 (39 lines) | stat: -rw-r--r-- 1,276 bytes parent folder | download | duplicates (2)
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     #4
// CHECK:      00003004 <__CortexA8657417_2FFE>:
// CHECK-NEXT:     3004:        b       #-4076