Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] package/Makefile.in: append endianness argument to TARGET_LD for MIPS
Date: Wed, 17 Feb 2016 23:41:14 +0100	[thread overview]
Message-ID: <56C4F70A.8060506@mind.be> (raw)
In-Reply-To: <20160217221313.439547e4@free-electrons.com>

On 17-02-16 22:13, Thomas Petazzoni wrote:
> Dear Vicente Olivert Riera,
> 
> On Wed, 17 Feb 2016 17:07:53 +0000, Vicente Olivert Riera wrote:
>> We don't use a wrapper for ld in Buildroot like we do for gcc, so when
>> using ld for linking (instead of gcc) the process can fail if the
>> appropriate arguments are not passed to it. For instance, this happens
>> when building perf (Linux -> Linux Kernel Tools -> perf) for MIPS little
>> endian, and this is how the error message looks like:
[snip]
>> +# Append the endianness argument to ld for MIPS architecture in order to
>> +# avoid problems like this one when using ld instead of gcc for linking:
>> +# mips-linux-gnu-ld: failed to merge target specific data of file foo.o
>> +# mips-linux-gnu-ld: foo.o: compiled for a little endian system and
>> +# target is big endian
>> +ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
>> +ifeq ($(BR2_ENDIAN),"BIG")
>> +TARGET_LD += -EB
>> +else
>> +TARGET_LD += -EL
>> +endif
>> +endif
> 
> This is really an horrible fix IMO. First because TARGET_LD is only
> meant to contain the path to the linker, and not additional flags.
> Additional flags should go in TARGET_LDFLAGS.
> 
> And secondly because programs should not use ld directly for linking,
> but gcc. Remember Vicente, you already fixed this issue in other
> packages and the fix was to use gcc instead of ld.

 So, are we really going to "fix" all packages that use ld directly? I don't see
why a package shouldn't be allowed to call ld when it is really doing linking
without any other toolchainy stuff.

 LDFLAGS has a bit of the same problem: there will probably be packages that
don't (completely) honour it.

 For CFLAGS, that was the reason why we introduced the wrapper. So I think we
should just add a wrapper for ld as well.

 Ideally the ld wrapper and the gcc wrapper should be refactored into the same
source file, but I think we could start out with separate sources and factor later.

 Any takers?


 Unless Vicente volunteers to work on an ld wrapper, I guess on the short term
we should take patches like these. That said, it should really be passed through
LDFLAGS and not LD itself.

 Regards,
 Arnout

> 
> Thomas
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

  reply	other threads:[~2016-02-17 22:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17 17:07 [Buildroot] [PATCH 1/2] package/Makefile.in: append endianness argument to TARGET_LD for MIPS Vicente Olivert Riera
2016-02-17 17:07 ` [Buildroot] [PATCH 2/2] linux/linux.mk: add LD="$(TARGET_LD)" to LINUX_MAKE_FLAGS Vicente Olivert Riera
2016-02-17 21:13 ` [Buildroot] [PATCH 1/2] package/Makefile.in: append endianness argument to TARGET_LD for MIPS Thomas Petazzoni
2016-02-17 22:41   ` Arnout Vandecappelle [this message]
2016-02-18  8:07     ` Thomas Petazzoni
2016-02-18  9:25       ` Peter Korsgaard
2016-02-18 14:20         ` Vicente Olivert Riera
2016-02-18 14:44           ` Peter Korsgaard
2016-02-20  9:34     ` Jan Heylen

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=56C4F70A.8060506@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /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