brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 6c1685d Raw
76 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -filetype=obj -triple=thumbv7-windows %s -o %t.obj3// RUN: lld-link -entry:main -subsystem:console %t.obj -out:%t.exe -map -verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s4// RUN: llvm-objdump --no-print-imm-hex -d %t.exe --start-address=0x401000 --stop-address=0x401022 | FileCheck --check-prefix=MAIN %s5// RUN: llvm-objdump --no-print-imm-hex -d %t.exe --start-address=0x501022 --stop-address=0x501032 | FileCheck --check-prefix=FUNC1 %s6// RUN: llvm-objdump --no-print-imm-hex -d %t.exe --start-address=0x601032 | FileCheck --check-prefix=FUNC2 %s7 8// VERBOSE: Added 3 thunks with margin {{.*}} in 1 passes9 10    .syntax unified11    .globl main12    .globl func113    .text14main:15    bne func116    bne func217    // This should reuse the same thunk as func1 above18    bne func1_alias19    bx lr20    .section .text$a, "xr"21    .space 0x10000022    .section .text$b, "xr"23func1:24func1_alias:25    // This shouldn't reuse the func2 thunk from above, since it is out26    // of range.27    bne func228    bx lr29    .section .text$c, "xr"30    .space 0x10000031    .section .text$d, "xr"32func2:33// Test using string tail merging. This is irrelevant to the thunking itself,34// but running multiple passes of assignAddresses() calls finalizeAddresses()35// multiple times; check that MergeChunk handles this correctly.36    movw r0, :lower16:"??_C@string1"37    movt r0, :upper16:"??_C@string1"38    movw r1, :lower16:"??_C@string2"39    movt r1, :upper16:"??_C@string2"40    bx lr41 42    .section .rdata,"dr",discard,"??_C@string1"43    .globl "??_C@string1"44"??_C@string1":45    .asciz "foobar"46    .section .rdata,"dr",discard,"??_C@string2"47    .globl "??_C@string2"48"??_C@string2":49    .asciz "bar"50 51// MAIN:    401000:       f040 8005       bne.w   0x40100e <.text+0xe>52// MAIN:    401004:       f040 8008       bne.w   0x401018 <.text+0x18>53// MAIN:    401008:       f040 8001       bne.w   0x40100e <.text+0xe>54// MAIN:    40100c:       4770            bx      lr55// func1 thunk56// MAIN:    40100e:       f240 0c08       movw    r12, #857// MAIN:    401012:       f2c0 0c10       movt    r12, #1658// MAIN:    401016:       44e7            add     pc,  r1259// func2 thunk60// MAIN:    401018:       f240 0c0e       movw    r12, #1461// MAIN:    40101c:       f2c0 0c20       movt    r12, #3262// MAIN:    401020:       44e7            add     pc,  r1263 64// FUNC1:   501022:       f040 8001       bne.w   0x501028 <.text+0x100028>65// FUNC1:   501026:       4770            bx      lr66// func2 thunk67// FUNC1:   501028:       f64f 7cfe       movw    r12, #6553468// FUNC1:   50102c:       f2c0 0c0f       movt    r12, #1569// FUNC1:   501030:       44e7            add     pc,  r1270 71// FUNC2:   601032:       f242 0000       movw    r0, #819272// FUNC2:   601036:       f2c0 0060       movt    r0, #9673// FUNC2:   60103a:       f242 0103       movw    r1, #819574// FUNC2:   60103e:       f2c0 0160       movt    r1, #9675// FUNC2:   601042:       4770            bx      lr76