This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Converting from little-endian to big-endian
- From: Ian Lance Taylor <iant at google dot com>
- To: Jeff Kenton <jeffrey dot kenton at comcast dot net>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 05 Nov 2010 16:56:49 -0700
- Subject: Re: Converting from little-endian to big-endian
- References: <4CD48FAC.9090106@comcast.net>
Jeff Kenton <jeffrey.kenton@comcast.net> writes:
> I have a little-endian gcc tool chain (gcc, gas, ld, ...) for a custom
> processor. The folks who built the tools are gone from the company.
> My job is to produce a big-endian set of tools (the processor can run
> either way) and need some hints. I have gotten gcc to do what looks
> OK by setting BYTES_BIG_ENDIAN, etc. but am having no success finding
> the right tweaks for gas. Any clues? Any overall strategy?
For gas look at gas/config/tc-CPU.h. Set TARGET_BYTES_BIG_ENDIAN. Then
figure out what BFD target you are using. Let's say it's
bfd/elf32-CPU.c. Look in that file for TARGET_LITTLE_SYM and
TARGET_LITTLE_NAME. Change them to TARGET_BIG_SYM and TARGET_BIG_NAME.
If it's not ELF, you'll have to do something else.
Ian