Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 1/4] toolchain: wrap 'ld' with toolchain-wrapper
Date: Sun, 16 Oct 2016 12:05:10 +0200	[thread overview]
Message-ID: <20161016120510.55c138f0@free-electrons.com> (raw)
In-Reply-To: <1459885521-25434-1-git-send-email-heyleke@gmail.com>

Hello,

On Tue,  5 Apr 2016 21:45:18 +0200, Jan Heylen wrote:
> extend the toolchain wrapper to also wrap the ld linker.
> 
> Tested with gnu ld and gnu 'gold'
> BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-gold=default --enable-plugins"
> 
> make host-binutils result in: (ld and ld.gold are equal)
> <ARCH>-buildroot-linux-uclibc-ld -> toolchain-wrapper
> <ARCH>-buildroot-linux-uclibc-ld.bfd
> <ARCH>-buildroot-linux-uclibc-ld.br_real
> <ARCH>-buildroot-linux-uclibc-ld.gold -> toolchain-wrapper
> <ARCH>-buildroot-linux-uclibc-ld.gold.br_real
> <ARCH>-linux-ld -> toolchain-wrapper
> <ARCH>-linux-ld.br_real -> <ARCH>-buildroot-linux-uclibc-ld.br_real
> <ARCH>-linux-ld.gold -> toolchain-wrapper
> <ARCH>-linux-ld.gold.br_real -> <ARCH>-buildroot-linux-uclibc-ld.gold.br_real
> toolchain-wrapper
> 
> after host-gcc-initial, toolchain-wrapper will be rebuild, but the ld
> symlinks remain
> 
> Based upon patch from Thomas Petazzoni:
> http://thread.gmane.org/gmane.comp.lib.uclibc.buildroot/60942

We had a discussion at the Buildroot Developers meeting today about
this patch series. After discussion, we concluded that there should be
no need to wrap ld. ld should not be used directly, except in very
specific cases, where the caller knows what it is doing and should pass
the right arguments.

As far as we know, the only case that was broken was the libiscsi
package, but such a package should definitely *not* use ld directly. So
the fix should be done in libiscsi, not in the wrapper.

However, your patch series triggered a very useful discussion about
reworking how flags are handled by the wrapper, and we took the
following notes of things to do:

 - We want to refactor how the CFLAGS are handled by the wrapper:

   - Combine BR2_TARGET_OPTIMIZATION and BR2_TARGET_LDFLAGS into a
     single BR2_TARGET_EXTRA_FLAGS

   - Have a make variable called TARGET_WRAPPER_FLAGS that includes
     all flags we want to include in the wrapper:

      * $(TARGET_ABI)
      * $(TARGET_CPPFLAGS)
      * $(BR2_TARGET_EXTRA_FLAGS)
      * Custom flags added by package/Makefile.in

     $(TARGET_OPTIMIZATION) and $(TARGET_DEBUGGING) are *NOT* in the
     wrapper.

   - TARGET_CFLAGS = $(TARGET_WRAPPER_CFLAGS) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
     TARGET_CXXFLAGS = $(TARGET_CFLAGS)
     TARGET_LDFLAGS = $(TARGET_CFLAGS)
     TARGET_FCFLAGS = $(TARGET_CFLAGS)

   - The wrapper, instead of having special cases for different flags,
     just receives (at build time), the list of hardcoded flag. A
     special logic needs to be put in place to handle precious flags
     (mcpu, march, mtune, mfloat-abi, etc.), for which the
     command-line passed flag must be preserved if passed.

 - Define LD to "false" in $(TARGET_CONFIGURE_OPTS) so that we detect
   the crappy packages that use LD directly. Individual packages can
   still pass LD=$(TARGET_LD) or LD=$(TARGET_CC) if really needed.

We're of course not asking you to work on those topics. Arnout has
volunteered to do it already.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  parent reply	other threads:[~2016-10-16 10:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-05 19:45 [Buildroot] [PATCH v2 1/4] toolchain: wrap 'ld' with toolchain-wrapper Jan Heylen
2016-04-05 19:45 ` [Buildroot] [PATCH v2 2/4] toolchain: add option to specify ld emulation Jan Heylen
2016-04-05 19:45 ` [Buildroot] [PATCH v2 3/4] toolchain: add TARGET_LDFLAGS to toolchain-wrapper Jan Heylen
2016-04-05 19:45 ` [Buildroot] [PATCH v2 4/4] arch: define appropriate ld emulation values for the MIPS architecture Jan Heylen
2016-10-16 10:05 ` Thomas Petazzoni [this message]
2016-10-16 11:36   ` [Buildroot] [PATCH v2 1/4] toolchain: wrap 'ld' with toolchain-wrapper Jan Heylen
2016-10-16 12:28     ` Thomas Petazzoni
2016-10-16 12:38       ` Vicente Olivert Riera
2016-10-16 15:00         ` Jan Heylen
2016-10-16 15:15           ` Vicente Olivert Riera
2016-10-16 15:19             ` Jan Heylen
2016-10-16 15:33               ` Vicente Olivert Riera
2016-10-16 17:27                 ` Jan Heylen
2016-10-24  6:00                   ` 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=20161016120510.55c138f0@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --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