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 20target 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 25declare i32 @mystrlen(i8* nocapture %s) nounwind readonly 26 27declare void @myhextochar(i32 %n, i8* nocapture %buffer) nounwind 28 29define internal i32 @foo0() nounwind readnone { 30entry: 31 ret i32 0 32} 33 34define internal i32 @foo1() nounwind readnone { 35entry: 36 ret i32 1 37} 38 39define internal i32 @foo2() nounwind readnone { 40entry: 41 ret i32 2 42} 43 44define internal i32 @foo3() nounwind readnone { 45entry: 46 ret i32 3 47} 48 49define internal i32 @foo4() nounwind readnone { 50entry: 51 ret i32 4 52} 53 54define internal i32 @foo5() nounwind readnone { 55entry: 56 ret i32 55 57} 58 59define internal i32 @foo6() nounwind readnone { 60entry: 61 ret i32 6 62} 63 64define internal i32 @foo7() nounwind readnone { 65entry: 66 ret i32 7 67} 68 69define internal i32 @foo8() nounwind readnone { 70entry: 71 ret i32 8 72} 73 74define internal i32 @foo9() nounwind readnone { 75entry: 76 ret i32 9 77} 78 79define i32 @main() nounwind { 80entry: 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 89declare void @exit(i32) noreturn nounwind 90 91;; OBJ: Relocation 1 92;; OBJ-NEXT: 'r_offset', 93;; OBJ-NEXT: 'r_sym', 0x00000c 94;; OBJ-NEXT: 'r_type', 0x2b 95 96;; OBJ: Symbol 12 97;; OBJ-NEXT: 'vtable' 98