lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed,  2 Mar 2016 18:39:37 -0600
From:	Josh Poimboeuf <>
To:	Ingo Molnar <>
	Stephen Rothwell <>,
	Masami Hiramatsu <>,
	Adrian Hunter <>,
	Michael Ellerman <>,
	Peter Zijlstra <>,
	Thomas Gleixner <>,
	"H. Peter Anvin" <>
Subject: [PATCH 2/2] objtool: Support CROSS_COMPILE

When building with CONFIG_STACK_VALIDATION on a ppc64le host with an x86
cross-compiler, Stephen Rothwell saw the following objtool build errors:

    DESCEND  objtool
    CC       /home/sfr/next/x86_64_allmodconfig/tools/objtool/builtin-check.o
    CC       /home/sfr/next/x86_64_allmodconfig/tools/objtool/special.o
    CC       /home/sfr/next/x86_64_allmodconfig/tools/objtool/elf.o
    CC       /home/sfr/next/x86_64_allmodconfig/tools/objtool/objtool.o
    MKDIR    /home/sfr/next/x86_64_allmodconfig/tools/objtool/arch/x86/insn/
    CC       /home/sfr/next/x86_64_allmodconfig/tools/objtool/libstring.o
  elf.c:22:23: fatal error: sys/types.h: No such file or directory
  compilation terminated.
    CC       /home/sfr/next/x86_64_allmodconfig/tools/objtool/exec-cmd.o
    CC       /home/sfr/next/x86_64_allmodconfig/tools/objtool/help.o
  builtin-check.c:28:20: fatal error: string.h: No such file or directory
  compilation terminated.
  objtool.c:28:19: fatal error: stdio.h: No such file or directory
  compilation terminated.

It fails to build because it tries to compile objtool with the
cross-compiler instead of the host compiler.

Ensure that it always uses the host compiler by ignoring CROSS_COMPILE.

In order to do that properly, the libsubcmd.a library needs to be built
in tools/objtool/ rather than tools/lib/subcmd/.  The latter directory
contains the cross-compiled version which is needed for perf and
possibly other tools.

Note that cross-compiling for x86 on a _big_ endian system would result
in a bunch of false positive objtool warnings during the kernel build
because it isn't endian-aware.  But that's generally a rare edge case
and there haven't been any reports of anybody needing that.

Reported-by: Stephen Rothwell <>
Signed-off-by: Josh Poimboeuf <>
 tools/lib/subcmd/Makefile |  6 ++++--
 tools/objtool/Makefile    | 17 ++++++++++-------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile
index 629cf8c..1faecb8 100644
--- a/tools/lib/subcmd/Makefile
+++ b/tools/lib/subcmd/Makefile
@@ -8,8 +8,10 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
 RM = rm -f
 MAKEFLAGS += --no-print-directory
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index c4f0713..e4a6bd5 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -7,13 +7,19 @@ ARCH := x86
+# always use the host compiler
+CC = gcc
+LD = ld
+AR = ar
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
-SUBCMD_SRCDIR	= $(srctree)/tools/lib/subcmd/
-LIBSUBCMD	= $(if $(OUTPUT),$(OUTPUT),$(SUBCMD_SRCDIR))libsubcmd.a
+SUBCMD_SRCDIR		= $(srctree)/tools/lib/subcmd/
 OBJTOOL    := $(OUTPUT)objtool
@@ -45,12 +51,9 @@ $(OBJTOOL): $(LIBSUBCMD) $(OBJTOOL_IN)
-	$(Q)$(MAKE) -C $(SUBCMD_SRCDIR) clean > /dev/null
-clean: $(LIBSUBCMD)-clean
 	$(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL)
 	$(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
 	$(Q)$(RM) $(OUTPUT)arch/x86/insn/inat-tables.c $(OUTPUT)fixdep

Powered by blists - more mailing lists