Jason W Kim | 953a2a3 | 2011-02-07 01:11:15 +0000 | [diff] [blame] | 1 | ;; RUN: llc -mtriple=armv7-linux-gnueabi -O3 \ |
| 2 | ;; RUN: -mcpu=cortex-a8 -mattr=-neon -mattr=+vfp2 -arm-reserve-r9 \ |
| 3 | ;; RUN: -filetype=obj %s -o - | \ |
| 4 | ;; RUN: elf-dump --dump-section-data | FileCheck -check-prefix=OBJ %s |
| 5 | |
| 6 | ;; FIXME: This file needs to be in .s form! |
| 7 | ;; The args to llc are there to constrain the codegen only. |
| 8 | ;; |
| 9 | ;; Ensure no regression on ARM/gcc compatibility for |
| 10 | ;; emitting explicit symbol relocs for nonexternal symbols |
| 11 | ;; versus section symbol relocs (with offset) - |
| 12 | ;; |
| 13 | ;; Default llvm behavior is to emit as section symbol relocs nearly |
| 14 | ;; everything that is not an undefined external. Unfortunately, this |
| 15 | ;; diverges from what codesourcery ARM/gcc does! |
| 16 | ;; |
| 17 | ;; Verifies that internal constants appear as explict symbol relocs |
| 18 | |
| 19 | |
| 20 | target triple = "armv7-none-linux-gnueabi" |
| 21 | |
| 22 | @startval = global i32 5 |
| 23 | @vtable = internal constant [10 x i32 (...)*] [i32 (...)* bitcast (i32 ()* @foo0 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo1 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo2 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo3 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo4 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo5 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo6 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo7 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo8 to i32 (...)*), i32 (...)* bitcast (i32 ()* @foo9 to i32 (...)*)] |
| 24 | |
| 25 | declare i32 @mystrlen(i8* nocapture %s) nounwind readonly |
| 26 | |
| 27 | declare void @myhextochar(i32 %n, i8* nocapture %buffer) nounwind |
| 28 | |
| 29 | define internal i32 @foo0() nounwind readnone { |
| 30 | entry: |
| 31 | ret i32 0 |
| 32 | } |
| 33 | |
| 34 | define internal i32 @foo1() nounwind readnone { |
| 35 | entry: |
| 36 | ret i32 1 |
| 37 | } |
| 38 | |
| 39 | define internal i32 @foo2() nounwind readnone { |
| 40 | entry: |
| 41 | ret i32 2 |
| 42 | } |
| 43 | |
| 44 | define internal i32 @foo3() nounwind readnone { |
| 45 | entry: |
| 46 | ret i32 3 |
| 47 | } |
| 48 | |
| 49 | define internal i32 @foo4() nounwind readnone { |
| 50 | entry: |
| 51 | ret i32 4 |
| 52 | } |
| 53 | |
| 54 | define internal i32 @foo5() nounwind readnone { |
| 55 | entry: |
| 56 | ret i32 55 |
| 57 | } |
| 58 | |
| 59 | define internal i32 @foo6() nounwind readnone { |
| 60 | entry: |
| 61 | ret i32 6 |
| 62 | } |
| 63 | |
| 64 | define internal i32 @foo7() nounwind readnone { |
| 65 | entry: |
| 66 | ret i32 7 |
| 67 | } |
| 68 | |
| 69 | define internal i32 @foo8() nounwind readnone { |
| 70 | entry: |
| 71 | ret i32 8 |
| 72 | } |
| 73 | |
| 74 | define internal i32 @foo9() nounwind readnone { |
| 75 | entry: |
| 76 | ret i32 9 |
| 77 | } |
| 78 | |
| 79 | define i32 @main() nounwind { |
| 80 | entry: |
| 81 | %0 = load i32* @startval, align 4 |
| 82 | %1 = getelementptr inbounds [10 x i32 (...)*]* @vtable, i32 0, i32 %0 |
| 83 | %2 = load i32 (...)** %1, align 4 |
| 84 | %3 = tail call i32 (...)* %2() nounwind |
| 85 | tail call void @exit(i32 %3) noreturn nounwind |
| 86 | unreachable |
| 87 | } |
| 88 | |
| 89 | declare void @exit(i32) noreturn nounwind |
| 90 | |
Rafael Espindola | f7179de | 2011-08-04 14:01:03 +0000 | [diff] [blame^] | 91 | ;; OBJ: Relocation 1 |
Jason W Kim | 953a2a3 | 2011-02-07 01:11:15 +0000 | [diff] [blame] | 92 | ;; OBJ-NEXT: 'r_offset', |
| 93 | ;; OBJ-NEXT: 'r_sym', 0x0000000c |
| 94 | ;; OBJ-NEXT: 'r_type', 0x0000002b |
Rafael Espindola | 7c18fa8 | 2011-03-20 18:44:20 +0000 | [diff] [blame] | 95 | |
| 96 | ;; OBJ: Symbol 0x0000000c |
| 97 | ;; OBJ-NEXT: 'vtable' |