brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.4 KiB · 9c46747 Raw
125 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %p/Inputs/arm-plt-reloc.s -o %t13// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t24// RUN: ld.lld %t1 %t2 -o %t5// RUN: llvm-objdump --no-print-imm-hex --triple=thumbv7a-none-linux-gnueabi -d %t | FileCheck %s6// RUN: ld.lld -shared %t1 %t2 -o %t.so7// RUN: llvm-objdump --no-print-imm-hex --triple=thumbv7a-none-linux-gnueabi -d %t.so | FileCheck --check-prefix=DSO %s8// RUN: llvm-readobj -S -r %t.so | FileCheck -check-prefix=DSOREL %s9 10// RUN: llvm-mc -filetype=obj -triple=thumbv7aeb-none-linux-gnueabi %p/Inputs/arm-plt-reloc.s -o %t111// RUN: llvm-mc -filetype=obj -triple=thumbv7aeb-none-linux-gnueabi %s -o %t212// RUN: ld.lld %t1 %t2 -o %t13// RUN: llvm-objdump --no-print-imm-hex --triple=thumbv7aeb-none-linux-gnueabi -d %t | FileCheck %s14// RUN: ld.lld -shared %t1 %t2 -o %t.so15// RUN: llvm-objdump --no-print-imm-hex --triple=thumbv7aeb-none-linux-gnueabi -d %t.so | FileCheck --check-prefix=DSO %s16// RUN: llvm-readobj -S -r %t.so | FileCheck -check-prefix=DSOREL %s17 18// RUN: ld.lld --be8 %t1 %t2 -o %t19// RUN: llvm-objdump --no-print-imm-hex --triple=thumbv7aeb-none-linux-gnueabi -d %t | FileCheck %s20// RUN: ld.lld --be8 -shared %t1 %t2 -o %t.so21// RUN: llvm-objdump --no-print-imm-hex --triple=thumbv7aeb-none-linux-gnueabi -d %t.so | FileCheck --check-prefix=DSO %s22// RUN: llvm-readobj -S -r %t.so | FileCheck -check-prefix=DSOREL %s23 24// Test PLT entry generation25 .syntax unified26 .text27 .align 228 .globl _start29 .type  _start,%function30_start:31// FIXME, interworking is only supported for BL via BLX at the moment, when32// interworking thunks are available for b.w and b<cond>.w this can be altered33// to test the different forms of interworking.34 bl func135 bl func236 bl func337 38// Executable, expect no PLT39// CHECK: Disassembly of section .text:40// CHECK-EMPTY:41// CHECK-NEXT: <func1>:42// CHECK-NEXT:   200b4: 4770    bx      lr43// CHECK: <func2>:44// CHECK-NEXT:   200b6: 4770    bx      lr45// CHECK: <func3>:46// CHECK-NEXT:   200b8: 4770    bx      lr47// CHECK-NEXT:   200ba: d4d4 48// CHECK: <_start>:49// CHECK-NEXT:   200bc: f7ff fffa       bl      0x200b4 <func1>50// CHECK-NEXT:   200c0: f7ff fff9       bl      0x200b6 <func2>51// CHECK-NEXT:   200c4: f7ff fff8       bl      0x200b8 <func3>52 53// Expect PLT entries as symbols can be preempted54// .text is Thumb and .plt is ARM, llvm-objdump can currently only disassemble55// as ARM or Thumb. Work around by disassembling twice.56// DSO: Disassembly of section .text:57// DSO-EMPTY:58// DSO-NEXT: <func1>:59// DSO-NEXT:     10214:     4770    bx      lr60// DSO: <func2>:61// DSO-NEXT:     10216:     4770    bx      lr62// DSO: <func3>:63// DSO-NEXT:     10218:     4770    bx      lr64// DSO-NEXT:     1021a:     d4d4 65// DSO: <_start>:66// 0x10250 = PLT func167// DSO-NEXT:     1021c:     f000 e818       blx     0x1025068// 0x10260 = PLT func269// DSO-NEXT:     10220:     f000 e81e       blx     0x1026070// 0x10270 = PLT func371// DSO-NEXT:     10224:     f000 e824       blx     0x1027072// DSO: Disassembly of section .plt:73// DSO-EMPTY:74// DSO-NEXT: <.plt>:75// DSO-NEXT:     10230:       e52de004        str     lr, [sp, #-4]!76// (0x10234 + 8) + (0 RoR 12) + (32 RoR 20 = 0x20000) + 164 = 0x302e0 = .got.plt[2]77// DSO-NEXT:     10234:       e28fe600        add     lr, pc, #0, #1278// DSO-NEXT:     10238:       e28eea20        add     lr, lr, #32, #2079// DSO-NEXT:     1023c:       e5bef0a4        ldr     pc, [lr, #164]!80 81// DSO-NEXT:     10240:       d4 d4 d4 d4     .word   0xd4d4d4d482// DSO-NEXT:     10244:       d4 d4 d4 d4     .word   0xd4d4d4d483// DSO-NEXT:     10248:       d4 d4 d4 d4     .word   0xd4d4d4d484// DSO-NEXT:     1024c:       d4 d4 d4 d4     .word   0xd4d4d4d485// (0x10250 + 8) + (0 RoR 12) + (32 RoR 20 = 0x20000) + 140 = 0x302e486// DSO-EMPTY:87// DSO-NEXT: <func1@plt>:88// DSO-NEXT:     10250:       e28fc600        add     r12, pc, #0, #1289// DSO-NEXT:     10254:       e28cca20        add     r12, r12, #32, #2090// DSO-NEXT:     10258:       e5bcf08c        ldr     pc, [r12, #140]!91// DSO-NEXT:     1025c:       d4 d4 d4 d4     .word   0xd4d4d4d492// (0x10260 + 8) + (0 RoR 12) + (32 RoR 20 = 0x20000) + 128 = 0x302e893// DSO-EMPTY:94// DSO-NEXT: <func2@plt>:95// DSO-NEXT:     10260:       e28fc600        add     r12, pc, #0, #1296// DSO-NEXT:     10264:       e28cca20        add     r12, r12, #32, #2097// DSO-NEXT:     10268:       e5bcf080        ldr     pc, [r12, #128]!98// DSO-NEXT:     1026c:       d4 d4 d4 d4     .word   0xd4d4d4d499// (0x10270 + 8) + (0 RoR 12) + (32 RoR 20 = 0x20000) + 116 = 0x302ec100// DSO-EMPTY:101// DSO-NEXT: <func3@plt>:102// DSO-NEXT:     10270:       e28fc600        add     r12, pc, #0, #12103// DSO-NEXT:     10274:       e28cca20        add     r12, r12, #32, #20104// DSO-NEXT:     10278:       e5bcf074        ldr     pc, [r12, #116]!105// DSO-NEXT:     1027c:       d4 d4 d4 d4     .word   0xd4d4d4d4106 107// DSOREL:    Name: .got.plt108// DSOREL-NEXT:    Type: SHT_PROGBITS109// DSOREL-NEXT:    Flags [110// DSOREL-NEXT:      SHF_ALLOC111// DSOREL-NEXT:      SHF_WRITE112// DSOREL-NEXT:    ]113// DSOREL-NEXT:    Address: 0x302D8114// DSOREL-NEXT:    Offset:115// DSOREL-NEXT:    Size: 24116// DSOREL-NEXT:    Link:117// DSOREL-NEXT:    Info:118// DSOREL-NEXT:    AddressAlignment: 4119// DSOREL-NEXT:    EntrySize:120// DSOREL:  Relocations [121// DSOREL-NEXT:  Section (5) .rel.plt {122// DSOREL-NEXT:    0x302E4 R_ARM_JUMP_SLOT func1123// DSOREL-NEXT:    0x302E8 R_ARM_JUMP_SLOT func2124// DSOREL-NEXT:    0x302EC R_ARM_JUMP_SLOT func3125