140 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t3// RUN: ld.lld %t --shared -o %t.so4// The output file is large, most of it zeroes. We dissassemble only the5// parts we need to speed up the test and avoid a large output file6// RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x1000004 --stop-address=0x100001c | FileCheck --check-prefix=CHECK1 %s7// RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x1100008 --stop-address=0x1100022 | FileCheck --check-prefix=CHECK2 %s8// RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x1100020 --stop-address=0x1100064 --triple=armv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK3 %s9 10/// A branch to a Thunk that we create on pass N, can drift out of range if11/// other Thunks are added in between. In this case we must create a new Thunk12/// for the branch that is in range. We also need to make sure that if the13/// destination of the Thunk is in the PLT the new Thunk also targets the PLT14 .syntax unified15 .thumb16 17 .macro FUNCTION suff18 .section .text.\suff\(), "ax", %progbits19 .thumb20 .balign 0x8000021 .globl tfunc\suff\()22 .type tfunc\suff\(), %function23tfunc\suff\():24 bx lr25 .endm26 27 .globl imported28 .type imported, %function29 .globl imported230 .type imported2, %function31 .globl imported332 .type imported3, %function33.globl imported434 .type imported4, %function35 FUNCTION 0036 FUNCTION 0137 FUNCTION 0238 FUNCTION 0339 FUNCTION 0440 FUNCTION 0541 FUNCTION 0642 FUNCTION 0743 FUNCTION 0844 FUNCTION 0945 FUNCTION 1046 FUNCTION 1147 FUNCTION 1248 FUNCTION 1349 FUNCTION 1450 FUNCTION 1551 FUNCTION 1652 FUNCTION 1753 FUNCTION 1854 FUNCTION 1955 FUNCTION 2056 FUNCTION 2157 FUNCTION 2258 FUNCTION 2359 FUNCTION 2460 FUNCTION 2561 FUNCTION 2662 FUNCTION 2763 FUNCTION 2864 FUNCTION 2965 FUNCTION 3066 FUNCTION 3167/// Precreated Thunk Pool goes here68// CHECK1: <__ThumbV7PILongThunk_imported>:69// CHECK1-NEXT: 1000004: f240 0c30 movw r12, #4870// CHECK1-NEXT: 1000008: f2c0 0c10 movt r12, #1671// CHECK1-NEXT: 100000c: 44fc add r12, pc72// CHECK1-NEXT: 100000e: 4760 bx r1273// CHECK1: <__ThumbV7PILongThunk_imported2>:74// CHECK1-NEXT: 1000010: f240 0c34 movw r12, #5275// CHECK1-NEXT: 1000014: f2c0 0c10 movt r12, #1676// CHECK1-NEXT: 1000018: 44fc add r12, pc77// CHECK1-NEXT: 100001a: 4760 bx r1278 79 .section .text.32, "ax", %progbits80 .space 0x8000081 .section .text.33, "ax", %progbits82 .space 0x80000 - 0x1483 .section .text.34, "ax", %progbits84 /// Need a Thunk to the PLT entry, can use precreated ThunkSection85 .globl callers86 .type callers, %function87callers:88 b.w imported89 beq.w imported90 b.w imported291// CHECK2: <__ThumbV7PILongThunk_imported>:92// CHECK2-NEXT: 1100008: f240 0c2c movw r12, #4493// CHECK2-NEXT: 110000c: f2c0 0c00 movt r12, #094// CHECK2-NEXT: 1100010: 44fc add r12, pc95// CHECK2-NEXT: 1100012: 4760 bx r1296// CHECK2: <callers>:97// CHECK2-NEXT: 1100014: f6ff bff6 b.w 0x1000004 <__ThumbV7PILongThunk_imported>98// CHECK2-NEXT: 1100018: f43f aff6 beq.w 0x1100008 <__ThumbV7PILongThunk_imported>99// CHECK2-NEXT: 110001c: f6ff bff8 b.w 0x1000010 <__ThumbV7PILongThunk_imported2>100 101// CHECK3: Disassembly of section .plt:102// CHECK3-EMPTY:103// CHECK3-NEXT: <.plt>:104// CHECK3-NEXT: 1100020: e52de004 str lr, [sp, #-4]!105// CHECK3-NEXT: 1100024: e28fe600 add lr, pc, #0, #12106// CHECK3-NEXT: 1100028: e28eea20 add lr, lr, #32107// CHECK3-NEXT: 110002c: e5bef094 ldr pc, [lr, #148]!108// CHECK3-NEXT: 1100030: d4 d4 d4 d4 .word 0xd4d4d4d4109// CHECK3-NEXT: 1100034: d4 d4 d4 d4 .word 0xd4d4d4d4110// CHECK3-NEXT: 1100038: d4 d4 d4 d4 .word 0xd4d4d4d4111// CHECK3-NEXT: 110003c: d4 d4 d4 d4 .word 0xd4d4d4d4112// CHECK3-EMPTY:113// CHECK3-NEXT: <imported@plt>:114// CHECK3-NEXT: 1100040: e28fc600 add r12, pc, #0, #12115// CHECK3-NEXT: 1100044: e28cca20 add r12, r12, #32116// CHECK3-NEXT: 1100048: e5bcf07c ldr pc, [r12, #124]!117// CHECK3-NEXT: 110004c: d4 d4 d4 d4 .word 0xd4d4d4d4118// CHECK3-EMPTY:119// CHECK3-NEXT: <imported2@plt>:120// CHECK3-NEXT: 1100050: e28fc600 add r12, pc, #0, #12121// CHECK3-NEXT: 1100054: e28cca20 add r12, r12, #32122// CHECK3-NEXT: 1100058: e5bcf070 ldr pc, [r12, #112]!123// CHECK3-NEXT: 110005c: d4 d4 d4 d4 .word 0xd4d4d4d4124 125// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7aeb-none-linux-gnueabi -mcpu=cortex-a8 %s -o %t126// RUN: ld.lld %t --shared -o %t.so127// The output file is large, most of it zeroes. We dissassemble only the128// parts we need to speed up the test and avoid a large output file129// RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x1000004 --stop-address=0x100001c | FileCheck --check-prefix=CHECK1 %s130// RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x1100008 --stop-address=0x1100022 | FileCheck --check-prefix=CHECK2 %s131// RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x1100020 --stop-address=0x1100064 --triple=armv7aeb-linux-gnueabihf | FileCheck --check-prefix=CHECK3 %s132 133// RUN: ld.lld --be8 %t --shared -o %t.so134// The output file is large, most of it zeroes. We dissassemble only the135// parts we need to speed up the test and avoid a large output file136// RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x1000004 --stop-address=0x100001c | FileCheck --check-prefix=CHECK1 %s137// RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x1100008 --stop-address=0x1100022 | FileCheck --check-prefix=CHECK2 %s138// RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x1100020 --stop-address=0x1100064 --triple=armv7aeb-linux-gnueabihf | FileCheck --check-prefix=CHECK3 %s139 140