File: arm_reloc_source.c

package info (click to toggle)
python-pyelftools 0.32-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 68,964 kB
  • sloc: python: 15,903; ansic: 298; asm: 86; makefile: 24; cpp: 18; sh: 4
file content (41 lines) | stat: -rw-r--r-- 854 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* Generated by compiling with any LLVM version and
** with any GNU Arm Embedded Toolchain version.
** LLVM 3.8.0/5.0.0 and GNU Arm Embedded Toolchain 2.26 is fine.
**
** clang -O0 --target=arm-none-eabi -emit-llvm -c simple.c -o simple.bc
** llc -O0 -march=arm -filetype=obj simple.bc -o reloc_simple_arm_llvm.o
** arm-none-eabi-ld -e main reloc_simple_arm_llvm.o -o simple_arm_llvm.elf
**
** reloc_simple_arm_llvm.o is ELF file that needs call relocation.
**
** simple_arm_llvm.elf is a relocated ELF file.
*/

int add(int a, int b) {
    return a + b;
}

int sub(int a, int b) {
    return a - b;
}

int mul(int a, int b) {
    return a * b;
}

void triple(int a, int b) {
    add(a, b);
    sub(a, b);
    mul(a, b);
}

int main(void) {
    int a = 0xABCD, b = 0x1234;

    add(a, b);
    sub(a, b);
    mul(a, b);
    triple(a, b);

    return 0;
}