selfie icon indicating copy to clipboard operation
selfie copied to clipboard

GCC RISC-V support

Open CAS-ual-TY opened this issue 3 years ago • 0 comments

This PR changes selfie in such a way that it also compiles for riscv64 gcc and runs on Unicorn.

To compile on a riscv64 cross compiler: riscv64-unknown-elf-gcc selfie.c -o selfie-riscv.o -no-pie -include "stdlib.h" -include "stdio.h" -include "unistd.h" -include "fcntl.h" The resulting selfie-riscv.o runs on Unicorn.

Changes:

Changes to compiler flags:

  • include stdint.h
  • include unistd.h
  • include fcntl.h
  • remove D'uint64_t=unsigned long' option (covered by stdint.h)
  • add -Wno-sign-compare -Wno-unused-result flags (should not interfere with student assignments)

Changed constants (due to conflict with header files):

  • UINT64_MAX to S_UINT64_MAX (conflict in stdint.h)
  • INT64_MIN to S_INT64_MIN (conflict in stdint.h)
  • INT64_MAX to S_INT64_MAX (conflict in stdint.h)
  • O_RDONLY to F_O_RDONLY

Changed method names (due to conflict with header files):

  • atoi to ascii_to_int
  • itoa to int_to_ascii

CAS-ual-TY avatar Dec 13 '22 15:12 CAS-ual-TY