http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52187
Bug #: 52187
Summary: armeb-unknown-eabi not recognized as big-endian
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: eg...@ofb.net
In gcc/config.gcc, the stanza for Linux recognizes arm*b-* and treats it as
big-endian:
arm*-*-linux*) # ARM GNU/Linux with ELF
tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h
glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
case $target in
arm*b-*)
tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
;;
esac
However, the similar stanza for other arm targets does not. In my case I am
using armeb-unknown-eabi (for a bare metal project), which means the
arm*-*-eabi* stanza takes place. This ignores the "eb" suffix and builds a
compiler which defaults to little endian. (Worse, libgcc is built in
little-endian mode, causing subtle bugs even with code compiled with
-mbig-endian.)
Copying the Linux arm*b-* section to the other stanza helps my case, but I'm
not sure it's a general solution.
Bug 16350 may be related -- possibly even a dupe -- though I'm not sure the
scope is the same. Good code _is_ generated with -mbig-endian, it just needs
to be recognized as the default for appropriate targets.