| 1 |
/* Generated by compiling with any LLVM version and |
| 2 |
** with any GNU Arm Embedded Toolchain version. |
| 3 |
** LLVM 3.8.0/5.0.0 and GNU Arm Embedded Toolchain 2.26 is fine. |
| 4 |
** |
| 5 |
** clang -O0 --target=arm-none-eabi -emit-llvm -c simple.c -o simple.bc |
| 6 |
** llc -O0 -march=arm -filetype=obj simple.bc -o reloc_simple_arm_llvm.o |
| 7 |
** arm-none-eabi-ld -e main reloc_simple_arm_llvm.o -o simple_arm_llvm.elf |
| 8 |
** |
| 9 |
** reloc_simple_arm_llvm.o is ELF file that needs call relocation. |
| 10 |
** |
| 11 |
** simple_arm_llvm.elf is a relocated ELF file. |
| 12 |
*/ |
| 13 |
|
| 14 |
int add(int a, int b) { |
| 15 |
return a + b; |
| 16 |
} |
| 17 |
|
| 18 |
int sub(int a, int b) { |
| 19 |
return a - b; |
| 20 |
} |
| 21 |
|
| 22 |
int mul(int a, int b) { |
| 23 |
return a * b; |
| 24 |
} |
| 25 |
|
| 26 |
void triple(int a, int b) { |
| 27 |
add(a, b); |
| 28 |
sub(a, b); |
| 29 |
mul(a, b); |
| 30 |
} |
| 31 |
|
| 32 |
int main(void) { |
| 33 |
int a = 0xABCD, b = 0x1234; |
| 34 |
|
| 35 |
add(a, b); |
| 36 |
sub(a, b); |
| 37 |
mul(a, b); |
| 38 |
triple(a, b); |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |