linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Nicolas Pitre <nico@linaro.org>, Andi Kleen <ak@linux.intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 3/7] [HACK] pass endianess flag to LTO linker
Date: Wed, 21 Feb 2018 08:37:04 +0000	[thread overview]
Message-ID: <CAKv+Gu-Be_saZeHzpWrjJBdeiOSJih0H-d1pjkpj+sq7ytLVyw@mail.gmail.com> (raw)
In-Reply-To: <20180220215954.4092811-4-arnd@arndb.de>

On 20 February 2018 at 21:59, Arnd Bergmann <arnd@arndb.de> wrote:
> We need some way to pass -mbig-endian to the linker during the
> LTO link stage, otherwise we get a waning like
>
> arm-linux-gnueabi/bin/ld: arch/arm/lib/clearbit.o: compiled for a big endian system and target is little endian
>
> for each file we link in.
>
> There is probably a better method of passing that flag, I'm just
> adding it to a different hack that I added earlier for x86 LTO
> here.
>

In general, LTO requires that *all* C flags are passed to the linker.
Given that linking now involves code generation, any C flag that
affects code generation must be visible to the linker as well, which
includes all the tweaks and overrides that we add per-file or
per-directory. It is not clear to me how much of this is carried in
the intermediate representation as metadata, but we should probably
err on the side of caution here, and update the Kbuild routines to
pass the complete value of KBUILD_CFLAGS (or whatever it is called) to
ld as well.



> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/arm/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 33b7eb4502aa..f39c2e2d55c0 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -49,11 +49,13 @@ endif
>
>  ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
>  KBUILD_CPPFLAGS        += -mbig-endian
> +KBUILD_BIARCHFLAGS += -mbig-endian
>  CHECKFLAGS     += -D__ARMEB__
>  AS             += -EB
>  LD             += -EB
>  else
>  KBUILD_CPPFLAGS        += -mlittle-endian
> +KBUILD_BIARCHFLAGS += -mlittle-endian
>  CHECKFLAGS     += -D__ARMEL__
>  AS             += -EL
>  LD             += -EL
> --
> 2.9.0
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2018-02-21  8:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 21:59 [PATCH 0/7] ARM: hacks for link-time optimization Arnd Bergmann
2018-02-20 21:59 ` [PATCH 1/7] ARM: disallow combining XIP and LTO Arnd Bergmann
2018-02-21  3:01   ` Nicolas Pitre
2018-02-21 11:50     ` Arnd Bergmann
2018-02-21 15:13       ` Nicolas Pitre
2018-03-12  2:40   ` Nicolas Pitre
2018-03-12 13:52     ` Arnd Bergmann
2018-03-12 16:46       ` Arnd Bergmann
2018-03-12 17:00         ` Nicolas Pitre
2018-03-12 17:05           ` Nicolas Pitre
2018-03-12 17:07           ` Arnd Bergmann
2018-02-20 21:59 ` [PATCH 2/7] ARM: LTO: avoid THUMB2_KERNEL+LTO Arnd Bergmann
2018-02-21  3:12   ` Nicolas Pitre
2018-02-21 11:48     ` Arnd Bergmann
2018-03-07 18:30   ` Matthias Kaehlcke
2018-03-07 18:52     ` Nicolas Pitre
2018-02-20 21:59 ` [PATCH 3/7] [HACK] pass endianess flag to LTO linker Arnd Bergmann
2018-02-21  3:15   ` Nicolas Pitre
2018-02-21  9:44     ` Arnd Bergmann
2018-02-21  8:37   ` Ard Biesheuvel [this message]
2018-02-21  9:48     ` Arnd Bergmann
2018-02-21 10:09       ` Ard Biesheuvel
2018-02-21 13:00         ` Arnd Bergmann
2018-02-20 21:59 ` [PATCH 4/7] ARM: io-acorn: fix LTO linking without CONFIG_PRINTK Arnd Bergmann
2018-02-20 21:59 ` [PATCH 5/7] ARM: fix __inflate_kernel_data stack warning for LTO Arnd Bergmann
2018-02-21  3:26   ` Nicolas Pitre
2018-02-20 21:59 ` [PATCH 6/7] ARM: mark assembler-referenced symbols as __visible Arnd Bergmann
2018-02-20 21:59 ` [PATCH 7/7] efi: disable LTO for EFI stub Arnd Bergmann
2018-12-17 22:50 ` [PATCH 0/7] ARM: hacks for link-time optimization Peter Zijlstra
2018-12-18  0:08   ` Andi Kleen
2018-12-18  9:18     ` Peter Zijlstra
2018-12-18 10:00       ` Peter Zijlstra
2018-12-21 14:23         ` Paul E. McKenney
2018-12-21 17:20       ` Andi Kleen
2018-12-21 18:00         ` Paul E. McKenney

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=CAKv+Gu-Be_saZeHzpWrjJBdeiOSJih0H-d1pjkpj+sq7ytLVyw@mail.gmail.com \
    --to=ard.biesheuvel@linaro.org \
    --cc=ak@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nico@linaro.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 NNTP newsgroup(s).