selfie
selfie copied to clipboard
GCC RISC-V support
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 bystdint.h) - add
-Wno-sign-compare -Wno-unused-resultflags (should not interfere with student assignments)
Changed constants (due to conflict with header files):
-
UINT64_MAXtoS_UINT64_MAX(conflict instdint.h) -
INT64_MINtoS_INT64_MIN(conflict instdint.h) -
INT64_MAXtoS_INT64_MAX(conflict instdint.h) -
O_RDONLYtoF_O_RDONLY
Changed method names (due to conflict with header files):
-
atoitoascii_to_int -
itoatoint_to_ascii