GCC as m68k cross compiler

I am trying to recompile binutils and GCC as a cross compiler for m68k architecture. I am following these instructions:

http://darkdust.net/writings/megadrive/crosscompiler

However, the process continues to fail on one side or another. I tried with binutils 2.16.1 and gcc 3.4.6, binutils 2.15 and gcc 3.4.2 and binutils 2.15 and gcc 3.4.6.

This last attempt fails when running "make" on gcc after binutils has been built and installed. It gives the following error:

gcc   -g -O2 -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings -Wstrict-
prototypes -Wmissing-prototypes -pedantic -Wno-long-long    -DHAVE_CONFIG_H    
-I. -I. -I../../gcc-3.4.2/gcc -I../../gcc-3.4.2/gcc/. -I../../gcc-
3.4.2/gcc/../include   \
-DTARGET_MACHINE=\"m68k-coff\" \
-c ../../gcc-3.4.2/gcc/collect2.c -o collect2.o

In file included from /usr/include/fcntl.h:289:0,
             from ../../gcc-3.4.2/gcc/system.h:214,
             from ../../gcc-3.4.2/gcc/collect2.c:30:

In function โ€˜openโ€™,
inlined from โ€˜collect_executeโ€™ at ../../gcc-3.4.2/gcc/collect2.c:1535:20:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:4: error: call to 
โ€˜__open_missing_modeโ€™ declared with attribute error: open with O_CREAT or 
O_TMPFILE in second argument needs 3 arguments
__open_missing_mode ();
^
Makefile:1364: recipe for target 'collect2.o' failed
make[1]: *** [collect2.o] Error 1
make[1]: Leaving directory '/home/gabriel/src/gcc-build/gcc'
Makefile:23339: recipe for target 'all-gcc' failed
make: *** [all-gcc] Error 2

      

I don't expect to fix this error, but does anyone know of a combination of binutils and gcc release that works? Should I be using a specific version of gcc to recompile gcc successfully?

Thanks for the understanding you can have on this!

EDIT:

My linux has GCC 5.4.0, so I just downloaded the 5.4.0 source to try and rebuild it to cross-compile the m68k. Now I am getting the following error when I run "make" in the gcc source:

*** Configuration m68k-unkown-coff not supported

      

What could be causing this? Is it because I need an older version of GCC? (the binutils version I'm using definitely supports the m68k target). The tutorial I'm using always defines "--target = m68k-coff" if instead "--target = m68k-unkown-coff"?

EDIT 2:

So, I tried compiling for m68k-elf, but now I am getting this error:

checking for m68k-elf-gcc... /home/gabriel/src/gcc-build/./gcc/xgcc -B/home/gabriel/src/gcc-build/./gcc/ -B/opt/m68k/m68k-elf/bin/ -B/opt/m68k/m68k-elf/lib/ -isystem /opt/m68k/m68k-elf/include -isystem /opt/m68k/m68k-elf/sys-include
checking for suffix of object files... configure: error: in `/home/gabriel/src/gcc-build/m68k-elf/libgcc':
configure: error: cannot compute suffix of object files: cannot compile

      

I ran download_prerequisites before building, so this shouldn't be a problem with the MPC library. Any idea how to proceed further? I only need an assembler, so I don't mind the object file format. Thank you!

+3


source to share


2 answers


I have often done what you are doing right now.

My advice is to use crosstool-ng ( http://crosstool-ng.github.io ) as it does almost everything automatically.

If you are looking into build m68k, I used a modified version of gcc-explorer Matt Godbolt ( https://godbolt.org/ ) to host . You can find a downloadable docker image here ( https://hub.docker.com/r/esantoro/acso-explorer/ ) and some details here ( https://znpy.wordpress.com/2017/05/08/decommisioning- acso-explorer-santoro-tk / )



Hope it helps,

ZnPy

+1


source


In the end I gave up and used this: https://www.onlinedisassembler.com/odaweb/YU6DCsrO/0 which worked well.



Many thanks for the help!

0


source







All Articles