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
6 ;; FIXME: This file needs to be in .s form!
7 ;; The args to llc are there to constrain the codegen only.
9 ;; Ensure no regression on ARM/gcc compatibility for
10 ;; emitting explicit symbol relocs for nonexternal symbols
11 ;; versus section symbol relocs (with offset) -
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!
17 ;; Verifies that internal constants appear as explict symbol relocs
20 target triple = "armv7-none-linux-gnueabi"
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 (...)*)]
25 declare i32 @mystrlen(i8* nocapture %s) nounwind readonly
27 declare void @myhextochar(i32 %n, i8* nocapture %buffer) nounwind
29 define internal i32 @foo0() nounwind readnone {
34 define internal i32 @foo1() nounwind readnone {
39 define internal i32 @foo2() nounwind readnone {
44 define internal i32 @foo3() nounwind readnone {
49 define internal i32 @foo4() nounwind readnone {
54 define internal i32 @foo5() nounwind readnone {
59 define internal i32 @foo6() nounwind readnone {
64 define internal i32 @foo7() nounwind readnone {
69 define internal i32 @foo8() nounwind readnone {
74 define internal i32 @foo9() nounwind readnone {
79 define i32 @main() nounwind {
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
89 declare void @exit(i32) noreturn nounwind
91 ;; OBJ: Relocation 0x00000001
92 ;; OBJ-NEXT: 'r_offset',
93 ;; OBJ-NEXT: 'r_sym', 0x0000000c
94 ;; OBJ-NEXT: 'r_type', 0x0000002b
96 ;; OBJ: Symbol 0x0000000c