From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Norbert Lange <nolange79@gmail.com>
Cc: buildroot@busybox.net
Subject: Re: [Buildroot] [PATCH v2 1/4] package/Makefile.in: use gcc wrappers for binutils tools
Date: Sun, 9 Jan 2022 16:08:40 +0100 [thread overview]
Message-ID: <20220109150840.GA1477939@scaer> (raw)
In-Reply-To: <20201017221743.160029-1-nolange79@gmail.com>
Norbert, All,
On 2020-10-18 00:17 +0200, Norbert Lange spake thusly:
> This will use gcc-ar, gcc-nm and gcc-ranlib instead of the
> normal binutils tools. The difference is that with the
> wrappers, gcc plugins will be automatically picked up.
>
> gcc 4.7 introduced these wrappers, to detect the prefix and
> keep gcc specifics out of Makefile.in, a new variable
> BR2_TOOLCHAIN_BUTILS_PREFIX will be used to carry the
> prefix on supported versions.
>
> Note that binutils added some automatic loading with the
> 'bfd-plugins' directory (somewhere around 2.28), but
> the first implementation had issues, and generally depends on
> correctly setup symlinks (often broken, may point to some
> other gcc's library). The wrappers always work painless.
>
> The original motivation (now ~2 years in use) was to add
> "-flto -ffat-lto-objects" to both BR2_TARGET_OPTIMIZATION and
> BR2_TARGET_LDFLAGS, and have target binaries lto optimized.
>
> Not all packages will compile with this option, further work
> could white/blacklist packages (adding -fno-lto to the
> options).
>
> Signed-off-by: Norbert Lange <nolange79@gmail.com>
> ---
> v1->v2:
> * support older gcc versions missing those wrappers
> ---
> package/Makefile.in | 6 +++---
> toolchain/Config.in | 7 +++++++
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/package/Makefile.in b/package/Makefile.in
> index 51f5cbce4f..665edec539 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -198,15 +198,15 @@ TARGET_CROSS = $(HOST_DIR)/bin/$(TOOLCHAIN_EXTERNAL_PREFIX)-
> endif
>
> # Define TARGET_xx variables for all common binutils/gcc
> -TARGET_AR = $(TARGET_CROSS)ar
> +TARGET_AR = $(TARGET_CROSS)$(call qstrip,$(BR2_TOOLCHAIN_BUTILS_PREFIX))ar
> TARGET_AS = $(TARGET_CROSS)as
> TARGET_CC = $(TARGET_CROSS)gcc
> TARGET_CPP = $(TARGET_CROSS)cpp
> TARGET_CXX = $(TARGET_CROSS)g++
> TARGET_FC = $(TARGET_CROSS)gfortran
> TARGET_LD = $(TARGET_CROSS)ld
> -TARGET_NM = $(TARGET_CROSS)nm
> -TARGET_RANLIB = $(TARGET_CROSS)ranlib
> +TARGET_NM = $(TARGET_CROSS)$(call qstrip,$(BR2_TOOLCHAIN_BUTILS_PREFIX))nm
> +TARGET_RANLIB = $(TARGET_CROSS)$(call qstrip,$(BR2_TOOLCHAIN_BUTILS_PREFIX))ranlib
> TARGET_READELF = $(TARGET_CROSS)readelf
> TARGET_OBJCOPY = $(TARGET_CROSS)objcopy
> TARGET_OBJDUMP = $(TARGET_CROSS)objdump
> diff --git a/toolchain/Config.in b/toolchain/Config.in
> index db2ab0f059..7a2becc09a 100644
> --- a/toolchain/Config.in
> +++ b/toolchain/Config.in
> @@ -732,4 +732,11 @@ config BR2_TOOLCHAIN_HAS_LIBQUADMATH
> bool
> default y if BR2_i386 || BR2_x86_64
>
> +# gcc ships with wrappers that will automatically pass arguments
> +# to the binutils tools.
> +# So far, those are paths to necessary linker plugins
> +config BR2_TOOLCHAIN_BUTILS_PREFIX
> + string
> + default "gcc-" if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
There was no need for a Kconfig option, so I moved that to the Makefile
side.
Applied to master, thanks.
Regards,
Yann E. MORIN.
> endmenu
> --
> 2.28.0
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2022-01-09 15:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-17 22:17 [Buildroot] [PATCH v2 1/4] package/Makefile.in: use gcc wrappers for binutils tools Norbert Lange
2020-10-17 22:17 ` [Buildroot] [PATCH v2 2/4] package/gcc: use binutils wrappers for target libs Norbert Lange
2022-01-09 15:16 ` Yann E. MORIN
2022-01-09 21:08 ` Norbert Lange
2022-01-10 10:43 ` Arnout Vandecappelle
2022-01-25 21:13 ` Arnout Vandecappelle
2020-10-17 22:17 ` [Buildroot] [PATCH v2 3/4] package/busybox: explicitly state binutil paths Norbert Lange
2022-01-09 15:09 ` Yann E. MORIN
2020-10-17 22:17 ` [Buildroot] [PATCH v2 4/4] package/glibc: force -fno-lto Norbert Lange
2022-01-09 22:31 ` Yann E. MORIN
2022-01-09 23:09 ` Norbert Lange
2022-01-10 7:29 ` Arnout Vandecappelle
2022-01-09 15:08 ` Yann E. MORIN [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=20220109150840.GA1477939@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@busybox.net \
--cc=nolange79@gmail.com \
/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