[PATCH 3/7] [HACK] pass endianess flag to LTO linker

Arnd Bergmann arnd at arndb.de
Tue Feb 20 13:59:50 PST 2018

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

Signed-off-by: Arnd Bergmann <arnd at 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
 KBUILD_CPPFLAGS	+= -mbig-endian
+KBUILD_BIARCHFLAGS += -mbig-endian
 AS		+= -EB
 LD		+= -EB
 KBUILD_CPPFLAGS	+= -mlittle-endian
+KBUILD_BIARCHFLAGS += -mlittle-endian
 AS		+= -EL
 LD		+= -EL

More information about the linux-arm-kernel mailing list