Hi Forum,
since some days i dig into MIPS Code and try to compile it. No success in building a MIPS Qemu System, i try now to build code for MIPS
with a Cross-Chain. For this i have installed mips-packages from the ports tree.
The tools popup as mips-unknown-freebsd13.1-*
Trying to compiling a cheap C-Program
However ends up in several error messages if i try to compile:
However, writing a simple assembler program, compiling it with AS and linking it with the MIPS LD works.
I tried to set the library path to a Toolchain under /usr/obj/mips.mips/ but without luck. I also checked against other options of LD and GCC but was not successfull as well.
How can i fix this issue and compile C code successfully?
Thanks
bulky
since some days i dig into MIPS Code and try to compile it. No success in building a MIPS Qemu System, i try now to build code for MIPS
with a Cross-Chain. For this i have installed mips-packages from the ports tree.
Code:
mips-binutils-2
mips-gcc9
The tools popup as mips-unknown-freebsd13.1-*
Code:
mips-unknown-freebsd13.1-addr2line mips-unknown-freebsd13.1-gcov-tool9
mips-unknown-freebsd13.1-ar mips-unknown-freebsd13.1-gcov9
mips-unknown-freebsd13.1-as mips-unknown-freebsd13.1-gprof
mips-unknown-freebsd13.1-c++9 mips-unknown-freebsd13.1-ld
mips-unknown-freebsd13.1-c++filt mips-unknown-freebsd13.1-ld.bfd
mips-unknown-freebsd13.1-cpp9 mips-unknown-freebsd13.1-nm
mips-unknown-freebsd13.1-elfedit mips-unknown-freebsd13.1-objcopy
mips-unknown-freebsd13.1-g++9 mips-unknown-freebsd13.1-objdump
mips-unknown-freebsd13.1-gcc-9.5.0 mips-unknown-freebsd13.1-ranlib
mips-unknown-freebsd13.1-gcc-ar9 mips-unknown-freebsd13.1-readelf
mips-unknown-freebsd13.1-gcc-nm9 mips-unknown-freebsd13.1-size
mips-unknown-freebsd13.1-gcc-ranlib9 mips-unknown-freebsd13.1-strings
mips-unknown-freebsd13.1-gcc9 mips-unknown-freebsd13.1-strip
mips-unknown-freebsd13.1-gcov-dump9
Trying to compiling a cheap C-Program
Code:
cat hw.c
#include <stdio.h>
int main(){
printf("Hello MIPS World\n");
return 0;
}
However ends up in several error messages if i try to compile:
Code:
mips-unknown-freebsd13.1-gcc9 hw.c -o hw
/usr/local/bin/mips-unknown-freebsd13.1-ld: /usr/lib/crt1.o: Relocations in generic ELF (EM: 62)
/usr/local/bin/mips-unknown-freebsd13.1-ld: /usr/lib/crt1.o: Relocations in generic ELF (EM: 62)
/usr/local/bin/mips-unknown-freebsd13.1-ld: /usr/lib/crt1.o: Relocations in generic ELF (EM: 62)
/usr/local/bin/mips-unknown-freebsd13.1-ld: /usr/lib/crt1.o: Relocations in generic ELF (EM: 62)
/usr/local/bin/mips-unknown-freebsd13.1-ld: /usr/lib/crt1.o: Relocations in generic ELF (EM: 62)
/usr/local/bin/mips-unknown-freebsd13.1-ld: /usr/lib/crt1.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
However, writing a simple assembler program, compiling it with AS and linking it with the MIPS LD works.
I tried to set the library path to a Toolchain under /usr/obj/mips.mips/ but without luck. I also checked against other options of LD and GCC but was not successfull as well.
How can i fix this issue and compile C code successfully?
Thanks
bulky