public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: "crossgcc@sourceware.org" <crossgcc@sourceware.org>,
	buildroot@uclibc.org <buildroot@uclibc.org>
Subject: Re: [Buildroot] Bizarre behavior of armeb toolchain
Date: Thu, 20 Jun 2013 13:52:00 -0000	[thread overview]
Message-ID: <20130620155236.45eda7ac@skate> (raw)
In-Reply-To: <20130620154130.1606594d@skate>


On Thu, 20 Jun 2013 15:41:30 +0200, Thomas Petazzoni wrote:

>  (*) On ARMv7 however, the code is different whether -mbig-endian is
>  passed or not, even though an "armeb-linux" compiler is supposed to
>  generate big endian code by default. When no flags is passed, both the
>  data *and* code are big-endian (so it's BE32 like on ARMv5), but
>  passing -mbig-endian makes the thing behave properly (code is
>  little-endian, data is big-endian).

Interestingly, this problem is visible when you run gcc with the -v
option, and look at the options passed to collect2.

when no options are passed to gcc (and it generates incorrect BE32
code), the options passed to collect2 are:

/home/test/outputs/armv7be/host/usr/libexec/gcc/armeb-buildroot-linux-uclibcgnueabi/4.7.3/collect2
	--sysroot=/home/test/outputs/armv7be/host/usr/armeb-buildroot-linux-uclibcgnueabi/sysroot
	--eh-frame-hdr
	-dynamic-linker /lib/ld-uClibc.so.0
	-X -m armelfb_linux_eabi -o toto
	[...]
	/tmp/ccJDVjCg.o

When -mbig-endian is passed to gcc, gcc then passes the following
options to collect2:

/home/test/outputs/armv7be/host/usr/libexec/gcc/armeb-buildroot-linux-uclibcgnueabi/4.7.3/collect2
	--sysroot=/home/test/outputs/armv7be/host/usr/armeb-buildroot-linux-uclibcgnueabi/sysroot
	--eh-frame-hdr
	--be8
	-dynamic-linker /lib/ld-uClibc.so.0
	-X -EB -m armelfb_linux_eabi -o toto
	[...]
	/tmp/ccnje5oi.o

Notice how it passes -EB and more importantly --be8, which indicates to
ld that it should swap code to make it little endian again (after it
has been generated big endian by as).

Best regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

--
For unsubscribe information see http://sourceware.org/lists.html#faq

      parent reply	other threads:[~2013-06-20 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20 13:41 Thomas Petazzoni
2013-06-20 13:49 ` [Buildroot] " Will Newton
2013-06-20 13:52 ` Thomas Petazzoni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130620155236.45eda7ac@skate \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@uclibc.org \
    --cc=crossgcc@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).