how to know host endianness in binutils
Nick Clifton
nickc@redhat.com
Tue Jan 2 11:29:15 GMT 2024
Hi Jan,
> looking around, I can't seem to be able to find any standardized way of
> knowing host endianness in binutils (in gas/ in particular).
There is a CYG_AC_C_ENDIAN function in config/acinclude.m4 that defines
LITTLE_ENDIAN_HOST for little endian hosts, but as far as I can tell this
function is never invoked.
> I can see config/tc-bpf.c checking WORDS_BIGENDIAN, but I couldn't
> convince myself (from looking at the generated config.h) that one can
> really rely on that.
Other code seems to rely upon this define too. For example gdb/tracectf.c.
Also as H.J. mentioned it does appear that the code in the script configure
does do the right thing. I would suggest that you can safely use it.
Cheers
Nick
More information about the Binutils
mailing list