kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

exec.c (635B)


      1 /* Fixture source for exec.elf — a freestanding static aarch64 ELF
      2  * executable. Regenerate with:
      3  *   kit cc -target aarch64-linux -ffreestanding -nostdlib -e _start \
      4  *            exec.c -o exec.elf
      5  * Committed as a binary so the -f / -p golden is decoupled from the
      6  * code generator (mirrors test/objdump/dwarf/dwarf.o). */
      7 static long sys_exit(long code) {
      8   register long x8 __asm__("x8") = 93; /* __NR_exit */
      9   register long x0 __asm__("x0") = code;
     10   __asm__ volatile("svc #0" : "+r"(x0) : "r"(x8) : "memory");
     11   return x0;
     12 }
     13 int compute(int a, int b) { return a * b + 7; }
     14 void _start(void) { sys_exit(compute(3, 5)); }