This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to specify big-endian build for SH3 toolchain?


On Thu, 2 Dec 2004, Dan Kegel wrote:

> Robert P. J. Day wrote:
> >   just to make sure i'm doing this properly, what do i have to do
> > change to get a *big*-endian build for SH3?  all i did was edit
> > sh3.dat and make the change:
> >
> > - TARGET_CFLAGS="-O -m3 -ml"
> > + TARGET_CFLAGS="-O -m3 -mb"
> >
> > i'm assuming there must be more since my big-endian build failed
> > partway through, complaining about a big-endian/little-endian clash,
> > which means that *part* of the build is still little-endian-oriented.
> >
> >   have i missed a config/build option somewhere?
>
> Try what I suggested in my previous message, namely figuring
> out what target name is conventionally used for a big-endian
> sh3 target (probably sh3eb-unknown-linux-gnu), and try that.
> Tools like binutils etc. often set their default endianness
> by looking at the target name.

  gotcha, i just finished reading that and will give it a shot.

> If that doesn't do it, we can look for more places to jam -mb, e.g.
> GCC_EXTRA_CONFIG="--enable-cxx-flags=-mb" or something like
> that...
> - Dan

  just for fun, i looked at the toolchain one can download from
www.sh-linux.org, and the various cross-compile invocations are (not
surprisingly) symlinks to a wrapper script, /usr/bin/shCPU-linux-GCC.

  the salient excerpt:

===============

case "${CPU}" in
    sh3)
        ARCH=m3
        DEFINES="-D__sh3__ -D__SH3__ -D__LITTLE_ENDIAN__"
        ENDIAN=ml
    ;;
    sh3eb)
        ARCH=m3
        DEFINES="-D__sh3__ -D__SH3__ -D__BIG_ENDIAN__"
        ENDIAN=mb
    ;;
    sh4)
        ARCH=m4
        DEFINES="-D__SH4__ -D__LITTLE_ENDIAN__"
        ENDIAN=ml
    ;;
    sh4eb)
        ARCH=m4
        DEFINES="-D__SH4__ -D__BIG_ENDIAN__"
        ENDIAN=mb
    ;;
esac

# Prepend the appropriate options
# If user specifies some options, it will be overridden

case "${PROG}" in
    cpp)
        exec sh-linux-${PROG} $DEFINES "$@"
    ;;
    c++|g++|g77|gcc|gcj)
        exec sh-linux-${PROG} -$ARCH -$ENDIAN "$@"
    ;;
esac

==============

  note how calling the compiler uses just the typical -m3 and -m[lb]
options, but calling the pre-processor adds in the options contained
in the $DEFINES variable.  is this what might be missing from the
current crosstool build?  (i'm still working my way thru some of the
logic.)

rday


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]