* [PATCH] arm64: Enforce endianness build flags for LD and AS
@ 2017-10-03 20:58 Guenter Roeck
2017-10-03 21:04 ` Doug Anderson
2017-10-04 18:31 ` Guenter Roeck
0 siblings, 2 replies; 4+ messages in thread
From: Guenter Roeck @ 2017-10-03 20:58 UTC (permalink / raw)
To: linux-arm-kernel
If LD or AS is specified on the command line using "make LD=<my-ld>",
the endianness flag will not be added. Depending on the toolchain used,
this can result in endianness mismatch errors, such as
aarch64-cros-linux-gnu/binutils-bin/2.27.0/ld.bfd.real:
arch/arm64/crypto/.tmp_aes-ce-cipher.o:
compiled for a big endian system and target is little endian
The problem was observed when using the Chrome OS build system (which sets
LD on the command line) for an arm64:allmodconfig build.
Use the override flag for both LD and AS to ensure that the endianness
flag is always set.
Cc: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
arch/arm64/Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 939b310913cf..d780d00bea9c 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -56,15 +56,15 @@ KBUILD_AFLAGS += $(call cc-option,-mabi=lp64)
ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
KBUILD_CPPFLAGS += -mbig-endian
CHECKFLAGS += -D__AARCH64EB__
-AS += -EB
-LD += -EB
+override AS += -EB
+override LD += -EB
LDFLAGS += -maarch64linuxb
UTS_MACHINE := aarch64_be
else
KBUILD_CPPFLAGS += -mlittle-endian
CHECKFLAGS += -D__AARCH64EL__
-AS += -EL
-LD += -EL
+override AS += -EL
+override LD += -EL
LDFLAGS += -maarch64linux
UTS_MACHINE := aarch64
endif
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] arm64: Enforce endianness build flags for LD and AS
2017-10-03 20:58 [PATCH] arm64: Enforce endianness build flags for LD and AS Guenter Roeck
@ 2017-10-03 21:04 ` Doug Anderson
2017-10-04 18:31 ` Guenter Roeck
1 sibling, 0 replies; 4+ messages in thread
From: Doug Anderson @ 2017-10-03 21:04 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Tue, Oct 3, 2017 at 1:58 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> If LD or AS is specified on the command line using "make LD=<my-ld>",
> the endianness flag will not be added. Depending on the toolchain used,
> this can result in endianness mismatch errors, such as
>
> aarch64-cros-linux-gnu/binutils-bin/2.27.0/ld.bfd.real:
> arch/arm64/crypto/.tmp_aes-ce-cipher.o:
> compiled for a big endian system and target is little endian
>
> The problem was observed when using the Chrome OS build system (which sets
> LD on the command line) for an arm64:allmodconfig build.
>
> Use the override flag for both LD and AS to ensure that the endianness
> flag is always set.
>
> Cc: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> arch/arm64/Makefile | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
This seems right to me. My understanding of the way things work is
that if you want a different linker or assembler you pass it on the
command line. That means you need "override" like this if you want to
append to it.
As a self-proclaimed non-expert on the kernel build system I'm not
sure it's worth much, but in any case:
Reviewed-by: Douglas Anderson <dianders@chromium.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] arm64: Enforce endianness build flags for LD and AS
2017-10-03 20:58 [PATCH] arm64: Enforce endianness build flags for LD and AS Guenter Roeck
2017-10-03 21:04 ` Doug Anderson
@ 2017-10-04 18:31 ` Guenter Roeck
2017-10-04 18:41 ` Guenter Roeck
1 sibling, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2017-10-04 18:31 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Oct 03, 2017 at 01:58:22PM -0700, Guenter Roeck wrote:
> If LD or AS is specified on the command line using "make LD=<my-ld>",
> the endianness flag will not be added. Depending on the toolchain used,
> this can result in endianness mismatch errors, such as
>
> aarch64-cros-linux-gnu/binutils-bin/2.27.0/ld.bfd.real:
> arch/arm64/crypto/.tmp_aes-ce-cipher.o:
> compiled for a big endian system and target is little endian
>
> The problem was observed when using the Chrome OS build system (which sets
> LD on the command line) for an arm64:allmodconfig build.
>
> Use the override flag for both LD and AS to ensure that the endianness
> flag is always set.
>
> Cc: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Please ignore this patch for now; it doesn't help with my problem. Not yet
sure what happens, but it appears that "-EB" doesn't make it into the LD
variable used by cmd_make_builtin in scripts/Makefile.build. I'll have
to figure out what is going on.
Thanks,
Guenter
> ---
> arch/arm64/Makefile | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index 939b310913cf..d780d00bea9c 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -56,15 +56,15 @@ KBUILD_AFLAGS += $(call cc-option,-mabi=lp64)
> ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
> KBUILD_CPPFLAGS += -mbig-endian
> CHECKFLAGS += -D__AARCH64EB__
> -AS += -EB
> -LD += -EB
> +override AS += -EB
> +override LD += -EB
> LDFLAGS += -maarch64linuxb
> UTS_MACHINE := aarch64_be
> else
> KBUILD_CPPFLAGS += -mlittle-endian
> CHECKFLAGS += -D__AARCH64EL__
> -AS += -EL
> -LD += -EL
> +override AS += -EL
> +override LD += -EL
> LDFLAGS += -maarch64linux
> UTS_MACHINE := aarch64
> endif
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] arm64: Enforce endianness build flags for LD and AS
2017-10-04 18:31 ` Guenter Roeck
@ 2017-10-04 18:41 ` Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2017-10-04 18:41 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Oct 04, 2017 at 11:31:08AM -0700, Guenter Roeck wrote:
> On Tue, Oct 03, 2017 at 01:58:22PM -0700, Guenter Roeck wrote:
> > If LD or AS is specified on the command line using "make LD=<my-ld>",
> > the endianness flag will not be added. Depending on the toolchain used,
> > this can result in endianness mismatch errors, such as
> >
> > aarch64-cros-linux-gnu/binutils-bin/2.27.0/ld.bfd.real:
> > arch/arm64/crypto/.tmp_aes-ce-cipher.o:
> > compiled for a big endian system and target is little endian
> >
> > The problem was observed when using the Chrome OS build system (which sets
> > LD on the command line) for an arm64:allmodconfig build.
> >
> > Use the override flag for both LD and AS to ensure that the endianness
> > flag is always set.
> >
> > Cc: Douglas Anderson <dianders@chromium.org>
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>
> Please ignore this patch for now; it doesn't help with my problem. Not yet
> sure what happens, but it appears that "-EB" doesn't make it into the LD
> variable used by cmd_make_builtin in scripts/Makefile.build. I'll have
> to figure out what is going on.
>
Yes, the problem is that the gcc in the Chrome OS toolchain doesn't tell
the linker which endianness to use (ie it doesn't translate -mbig-endian
into a linker flag). Please forget this patch, it doesn't solve anything.
Sorry for the noise.
Guenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-04 18:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-03 20:58 [PATCH] arm64: Enforce endianness build flags for LD and AS Guenter Roeck
2017-10-03 21:04 ` Doug Anderson
2017-10-04 18:31 ` Guenter Roeck
2017-10-04 18:41 ` Guenter Roeck
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).