brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.9 KiB · df2b960 Raw
133 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -filetype=obj -arm-add-build-attributes -triple=thumbv8-none-linux-gnueabi --arch=thumb --mcpu=cortex-m33 %p/Inputs/arm-plt-reloc.s -o %t1.o3// RUN: llvm-mc -filetype=obj -arm-add-build-attributes -triple=thumbv8-none-linux-gnueabi --arch=thumb --mcpu=cortex-m33 %s -o %t2.o4// RUN: ld.lld %t1.o %t2.o -o %t5// RUN: llvm-objdump --no-print-imm-hex -d %t | FileCheck %s6// RUN: ld.lld -shared %t1.o %t2.o -o %t.so7// RUN: llvm-objdump --no-print-imm-hex -d %t.so | FileCheck --check-prefix=DSO %s8// RUN: llvm-readelf -S -r %t.so | FileCheck -check-prefix=DSOREL %s9 10// RUN: llvm-mc -filetype=obj -arm-add-build-attributes -triple=thumbv8-none-linux-gnueabi --arch=thumbeb --mcpu=cortex-m33 %p/Inputs/arm-plt-reloc.s -o %t1.be.o11// RUN: llvm-mc -filetype=obj -arm-add-build-attributes -triple=thumbv8-none-linux-gnueabi --arch=thumbeb --mcpu=cortex-m33 %s -o %t2.be.o12// RUN: ld.lld %t1.be.o %t2.be.o -o %t.be13// RUN: llvm-objdump --no-print-imm-hex -d %t.be | FileCheck %s14// RUN: ld.lld -shared %t1.be.o %t2.be.o -o %t.so.be15// RUN: llvm-objdump --no-print-imm-hex -d %t.so.be | FileCheck --check-prefix=DSO %s16// RUN: llvm-readelf -S -r %t.so.be | FileCheck -check-prefix=DSOREL %s17 18// RUN: ld.lld --be8 %t1.be.o %t2.be.o -o %t.be19// RUN: llvm-objdump --no-print-imm-hex -d %t.be | FileCheck %s20// RUN: ld.lld --be8 -shared %t1.be.o %t2.be.o -o %t.so.be21// RUN: llvm-objdump --no-print-imm-hex -d %t.so.be | FileCheck --check-prefix=DSO %s22// RUN: llvm-readelf -S -r %t.so.be | FileCheck -check-prefix=DSOREL %s23 24/// Test PLT entry generation25 .text26 .align 227 .globl _start28 .type  _start,%function29_start:30 bl func131 bl func232 bl func333 b.w func134 b.w func235 b.w func336 beq.w func137 beq.w func238 beq.w func339 40/// Executable, expect no PLT41// CHECK: Disassembly of section .text:42// CHECK-EMPTY:43// CHECK-NEXT: <func1>:44// CHECK-NEXT:   bx      lr45// CHECK: <func2>:46// CHECK-NEXT:   bx      lr47// CHECK: <func3>:48// CHECK-NEXT:   bx      lr49// CHECK-NEXT:   d4d4 50// CHECK: <_start>:51// CHECK-NEXT:   bl      {{.*}} <func1>52// CHECK-NEXT:   bl      {{.*}} <func2>53// CHECK-NEXT:   bl      {{.*}} <func3>54// CHECK-NEXT:   b.w     {{.*}} <func1>55// CHECK-NEXT:   b.w     {{.*}} <func2>56// CHECK-NEXT:   b.w     {{.*}} <func3>57// CHECK-NEXT:   beq.w	 {{.*}} <func1>58// CHECK-NEXT:   beq.w	 {{.*}} <func2>59// CHECK-NEXT:   beq.w	 {{.*}} <func3>60 61// DSO: Disassembly of section .text:62// DSO-EMPTY:63// DSO-NEXT: <func1>:64// DSO-NEXT:     bx      lr65// DSO: <func2>:66// DSO-NEXT:     bx      lr67// DSO: <func3>:68// DSO-NEXT:     bx      lr69// DSO-NEXT:     d4d4 70// DSO: <_start>:71/// 0x10260 = PLT func172// DSO-NEXT:     bl     0x1026073/// 0x10270 = PLT func274// DSO-NEXT:     bl     0x1027075/// 0x10280 = PLT func376// DSO-NEXT:     bl     0x1028077/// 0x10260 = PLT func178// DSO-NEXT:     b.w    0x1026079/// 0x10270 = PLT func280// DSO-NEXT:     b.w    0x1027081/// 0x10280 = PLT func382// DSO-NEXT:     b.w    0x1028083/// 0x10260 = PLT func184// DSO-NEXT:     beq.w	 0x1026085/// 0x10270 = PLT func286// DSO-NEXT:     beq.w	 0x1027087/// 0x10280 = PLT func388// DSO-NEXT:     beq.w	 0x1028089// DSO: Disassembly of section .plt:90// DSO-EMPTY:91// DSO-NEXT: 10240 <.plt>:92// DSO-NEXT:     push    {lr}93// DSO-NEXT:     ldr.w   lr, [pc, #8]94// DSO-NEXT:     add     lr, pc95// DSO-NEXT:     ldr     pc, [lr, #8]!96/// 0x20098 = .got.plt (0x302D8) - pc (0x10238 = .plt + 8) - 897// DSO-NEXT:     .word   0x0002009898// DSO-NEXT:     .word   0xd4d4d4d499// DSO-NEXT:     .word   0xd4d4d4d4100// DSO-NEXT:     .word   0xd4d4d4d4101// DSO-NEXT:     .word   0xd4d4d4d4102 103/// 136 + 2 << 16 + 0x1026c = 0x302f4 = got entry 1104// DSO-EMPTY:105// DSO-NEXT:     <func1@plt>:106// DSO-NEXT:     10260:       f240 0c88     movw    r12, #136107// DSO-NEXT:                  f2c0 0c02     movt    r12, #2108// DSO-NEXT:                  44fc          add     r12, pc109// DSO-NEXT:                  f8dc f000     ldr.w   pc, [r12]110// DSO-NEXT:                  e7fc          b       0x1026a111/// 124 + 2 << 16 + 0x1027c = 0x302f8 = got entry 2112// DSO-EMPTY:113// DSO-NEXT:     <func2@plt>:114// DSO-NEXT:     10270:       f240 0c7c     movw    r12, #124115// DSO-NEXT:                  f2c0 0c02     movt    r12, #2116// DSO-NEXT:                  44fc          add     r12, pc117// DSO-NEXT:                  f8dc f000     ldr.w   pc, [r12]118// DSO-NEXT:                  e7fc          b       0x1027a119/// 112 + 2 << 16 + 0x1028c = 0x302fc = got entry 3120// DSO-EMPTY:121// DSO-NEXT:     <func3@plt>:122// DSO-NEXT:     10280:       f240 0c70     movw    r12, #112123// DSO-NEXT:                  f2c0 0c02     movt    r12, #2124// DSO-NEXT:                  44fc          add     r12, pc125// DSO-NEXT:                  f8dc f000     ldr.w   pc, [r12]126// DSO-NEXT:                  e7fc          b       0x1028a127 128// DSOREL: .got.plt PROGBITS 000302e8 {{.*}} 000018 00  WA  0   0  4129// DSOREL: Relocation section '.rel.plt'130// DSOREL: 000302f4 {{.*}} R_ARM_JUMP_SLOT {{.*}} func1131// DSOREL: 000302f8 {{.*}} R_ARM_JUMP_SLOT {{.*}} func2132// DSOREL: 000302fc {{.*}} R_ARM_JUMP_SLOT {{.*}} func3133