GCC 7

Ask anything your want about the 32X Mushroom programming.

Moderator: BigEvilCorporation

Post Reply
Grind
Very interested
Posts: 69
Joined: Fri Jun 13, 2014 1:26 pm
Location: US
Contact:

GCC 7

Post by Grind » Mon Aug 21, 2017 11:48 am

I'm having some issues getting any GCC newer than 4.x to build libgcc for SH. Gendev also had this issue if you tried to use a newer GCC than it used (4.8.6 I think) back when it supported 32X.

The error:

Code: Select all

/home/grind/marsdev/toolchain/gcc-7.2.0/build/./gcc/xgcc -B/home/grind/marsdev/toolchain/gcc-7.2.0/build/./gcc/ -B/home/grind/mars/sh-elf/sh-elf/bin/ -B/home/grind/mars/sh-elf/sh-elf/lib/ -isystem /home/grind/mars/sh-elf/sh-elf/include -isystem /home/grind/mars/sh-elf/sh-elf/sys-include    -g -O2 -m1 -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -I. -I. -I../../.././gcc -I../../../../libgcc -I../../../../libgcc/. -I../../../../libgcc/../gcc -I../../../../libgcc/../include    -o _movmem_i4_s.o -MT _movmem_i4_s.o -MD -MP -MF _movmem_i4_s.dep -DSHARED -DL_movmem_i4 -xassembler-with-cpp -c ../../../../libgcc/config/sh/lib1funcs.S
../../../../libgcc/config/sh/lib1funcs.S: Assembler messages:
../../../../libgcc/config/sh/lib1funcs.S:933: Error: opcode not valid for this cpu variant
../../../../libgcc/config/sh/lib1funcs.S:935: Error: opcode not valid for this cpu variant
../../../../libgcc/config/sh/lib1funcs.S:942: Error: opcode not valid for this cpu variant
../../../../libgcc/config/sh/lib1funcs.S:944: Error: opcode not valid for this cpu variant
Makefile:481: recipe for target '_movmem_i4_s.o' failed
make[6]: *** [_movmem_i4_s.o] Error 1
make[6]: Leaving directory '/home/grind/marsdev/toolchain/gcc-7.2.0/build/sh-elf/m1/libgcc'
Makefile:1198: recipe for target 'multi-do' failed
make[5]: *** [multi-do] Error 1
make[5]: Leaving directory '/home/grind/marsdev/toolchain/gcc-7.2.0/build/sh-elf/libgcc'
Makefile:123: recipe for target 'all-multi' failed
make[4]: *** [all-multi] Error 2
make[4]: Leaving directory '/home/grind/marsdev/toolchain/gcc-7.2.0/build/sh-elf/libgcc'
Makefile:13111: recipe for target 'all-target-libgcc' failed
make[3]: *** [all-target-libgcc] Error 2
make[3]: Leaving directory '/home/grind/marsdev/toolchain/gcc-7.2.0/build'
Makefile:896: recipe for target 'all' failed
My commands:

Code: Select all

cd gcc-7.2.0 && ./contrib/download_prerequisites \
	> /home/grind/marsdev/toolchain/gcc-sh.log 2>&1
cd gcc-7.2.0/build && \
	../configure --target=sh-elf --prefix=/home/grind/mars/sh-elf \
	--without-headers --enable-languages=c,c++ --with-endian=big --with-cpu=m2 \
	--disable-threads --disable-shared --disable-libssp \
	--disable-tls --disable-nls --disable-werror \
	>> /home/grind/marsdev/toolchain/gcc-sh.log 2>&1
make -C gcc-7.2.0/build all install-strip \
	>> /home/grind/marsdev/toolchain/gcc-sh.log 2>&1
Google is not aware of the existence of this error, and the GCC 5 change notes don't mention having to change things for SH. So what's up? Do people who use C for 32X dev skip libgcc or something?

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: GCC 7

Post by Sik » Mon Aug 21, 2017 1:12 pm

You can't skip libgcc, it's pretty much what GCC uses when there's something it can't afford to do with just a few instructions (e.g. division on platforms that lack hardware dividers or floating point on systems without a FPU, etc.).

Found this, it's extremely old, but other similar stuff around seems to hint it's still relevant (and SH4 is affected too, lol). So, likely a config issue?
http://landley.net/mantis/mantis-1446.html

EDIT: also dunno if this helps but
https://github.com/SaturnSDK/Saturn-SDK-GCC-SH2
Sik is pronounced as "seek", not as "sick".

Grind
Very interested
Posts: 69
Joined: Fri Jun 13, 2014 1:26 pm
Location: US
Contact:

Re: GCC 7

Post by Grind » Mon Aug 21, 2017 2:56 pm

Well apparently, --disable-multilib was what I was missing. Thanks for the link, forgot Saturn had one of those things too.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: GCC 7

Post by Chilly Willy » Mon Aug 21, 2017 5:03 pm

This is my "usual" makefile, updated to gcc 7.1.0, binutils 2.28, and newlib 2.5.0.

https://pastebin.com/fxaYnpSx

Those were all the latest when I made that... looks like it's time to update AGAIN. They really keep pumping out the updates to gcc lately. Gcc 7 does a lot of optimizations when using -Ofast.

Post Reply