|
| 1 | +; REQUIRES: arm-registered-target |
| 2 | + |
| 3 | +;; Verify that the generated assembly omits the RTTI proxy and uses the correct |
| 4 | +;; relocations and addends. |
| 5 | +; RUN: llc %s -mtriple=armv7 -o - | FileCheck %s |
| 6 | + |
| 7 | +;; Verify that the generated object uses the correct relocations and addends. |
| 8 | +; RUN: llc %s -filetype=obj -mtriple=thumbv7 -o %t.o |
| 9 | +; RUN: llvm-readelf --relocs --hex-dump=.rodata %t.o | FileCheck --check-prefix=OBJ %s |
| 10 | + |
| 11 | +@vtable = dso_local unnamed_addr constant i32 sub (i32 ptrtoint (ptr @rtti.proxy to i32), i32 ptrtoint (ptr @vtable to i32)), align 4 |
| 12 | + |
| 13 | +@vtable_with_offset = dso_local unnamed_addr constant [2 x i32] [i32 0, i32 sub (i32 ptrtoint (ptr @rtti.proxy to i32), i32 ptrtoint (ptr @vtable_with_offset to i32))], align 4 |
| 14 | + |
| 15 | +@vtable_with_negative_offset = dso_local unnamed_addr constant [2 x i32] [ |
| 16 | + i32 sub ( |
| 17 | + i32 ptrtoint (ptr @rtti.proxy to i32), |
| 18 | + i32 ptrtoint (ptr getelementptr inbounds ([2 x i32], ptr @vtable_with_negative_offset, i32 0, i32 1) to i32) |
| 19 | + ), |
| 20 | + i32 0 |
| 21 | +], align 4 |
| 22 | + |
| 23 | +@rtti = external global i8, align 4 |
| 24 | +@rtti.proxy = linkonce_odr hidden unnamed_addr constant ptr @rtti |
| 25 | + |
| 26 | +; CHECK-NOT: rtti.proxy |
| 27 | + |
| 28 | +; CHECK-LABEL: vtable: |
| 29 | +; CHECK-NEXT: .long rtti(GOT_PREL)+0{{$}} |
| 30 | + |
| 31 | +; CHECK-LABEL: vtable_with_offset: |
| 32 | +; CHECK-NEXT: .long 0 |
| 33 | +; CHECK-NEXT: .long rtti(GOT_PREL)+4{{$}} |
| 34 | + |
| 35 | +; CHECK-LABEL: vtable_with_negative_offset: |
| 36 | +; CHECK-NEXT: .long rtti(GOT_PREL)-4{{$}} |
| 37 | +; CHECK-NEXT: .long 0 |
| 38 | + |
| 39 | +; OBJ-LABEL: Relocation section '.rel.rodata' at offset [[#%#x,]] contains 3 entries: |
| 40 | +; OBJ: {{^}}00000000 [[#]] R_ARM_GOT_PREL [[#]] rtti{{$}} |
| 41 | +; OBJ-NEXT: {{^}}00000008 [[#]] R_ARM_GOT_PREL [[#]] rtti{{$}} |
| 42 | +; OBJ-NEXT: {{^}}0000000c [[#]] R_ARM_GOT_PREL [[#]] rtti{{$}} |
| 43 | + |
| 44 | +; OBJ-LABEL: Hex dump of section '.rodata': |
| 45 | +; OBJ-NEXT: 0x00000000 00000000 00000000 04000000 fcffffff |
0 commit comments