[Bug target/50694] SH Target: SH2A little endian does not actually work

oleg.endo@t-online.de gcc-bugzilla@gcc.gnu.org
Tue Oct 18 21:33:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50694

--- Comment #3 from Oleg Endo <oleg.endo@t-online.de> 2011-10-18 21:33:06 UTC ---
(In reply to comment #2)
> Ah.  One liner
> 
> -#define DRIVER_SELF_SPECS "%{m2a:%{ml:%eSH2a does not support little-endian}}"
> +#define DRIVER_SELF_SPECS "%{m2a*:%{ml:%eSH2a does not support
> little-endian}}"
> 
> should work.

Yep, does work. 
However, I've noticed that it will stop working when the compiler's default
SH CPU and endian configuration is not -m1 -mb.

The code below instead gets the job done but I'm not sure whether it could
be written in a better way.
I've also noticed, that SH1 also supports big endian only, and -m1 -ml is
explicitly excluded in the multilib config in t-sh.

#if TARGET_ENDIAN_DEFAULT == MASK_BIG_ENDIAN
#define IS_LITTLE_ENDIAN_OPTION "%{ml:"
#else
#define IS_LITTLE_ENDIAN_OPTION "%{!mb:"
#endif

#if TARGET_CPU_DEFAULT == SELECT_SH1
#define UNSUPPORTED_SH1 IS_LITTLE_ENDIAN_OPTION \
"%{m1|!m2*:%{!m3*:%{!m4*:%{!m5*:%eSH1 does not support little-endian}}}}}"
#else
#define UNSUPPORTED_SH1 IS_LITTLE_ENDIAN_OPTION \
"%{m1:%eSH1 does not support little-endian}}"
#endif

#if TARGET_CPU_DEFAULT & MASK_HARD_SH2A
#define UNSUPPORTED_SH2A IS_LITTLE_ENDIAN_OPTION \
"%{m2a*|!m1:%{!m2*:%{!m3*:%{!m4*:{!m5*:%eSH2a does not support
little-endian}}}}}}"
#else
#define UNSUPPORTED_SH2A IS_LITTLE_ENDIAN_OPTION \
"%{m2a*:%eSH2a does not support little-endian}}"
#endif

#define DRIVER_SELF_SPECS UNSUPPORTED_SH1, UNSUPPORTED_SH2A



Actually, SH2E also supports big endian only as per public specification.
But I don't think that it would cause any trouble for anyone.  Of course it
could be excluded as well. :)



More information about the Gcc-bugs mailing list