Because of that, I'm using these as my GCC args:
Code: Select all
-ffreestanding -mgeneral-regs-only -Wall -Wextra -Werror
Code: Select all
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
Code: Select all
-nostartfiles
Code: Select all
/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000001000
ld: attempted static link of dynamic object `build/main.o'
Code: Select all
-static
Code: Select all
ld: cannot use executable file 'build/main.o' as input to a link
UPDATE: I added -m32... that made it WAY worse.
Code: Select all
/usr/bin/ld: cannot find Scrt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/12/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 when searching for libgcc_s.so.1
/usr/bin/ld: cannot find libgcc_s.so.1: No such file or directory
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 when searching for libgcc_s.so.1
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/12/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc: No such file or directory