Skip to content

Commit

Permalink
BACKPORT: tools: Factor HOSTCC, HOSTLD, HOSTAR definitions
Browse files Browse the repository at this point in the history
Several Makefiles in tools/ need to define the host toolchain variables.
Move their definition to tools/scripts/Makefile.include

Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/bpf/20201110164310.2600671-2-jean-philippe@linaro.org
(cherry picked from commit c8a950d)
Bug: 145210207
Signed-off-by: Alistair Delva <adelva@google.com>
Change-Id: Ia2694f0afb5546d9d118e77425fb3dc1eaece07a
  • Loading branch information
jpbrucker authored and adelva1984 committed Jan 28, 2021
1 parent 9194764 commit a972484
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 27 deletions.
9 changes: 0 additions & 9 deletions tools/bpf/resolve_btfids/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ else
endif

# always use the host compiler
ifneq ($(LLVM),)
HOSTAR ?= llvm-ar
HOSTCC ?= clang
HOSTLD ?= ld.lld
else
HOSTAR ?= ar
HOSTCC ?= gcc
HOSTLD ?= ld
endif
AR = $(HOSTAR)
CC = $(HOSTCC)
LD = $(HOSTLD)
Expand Down
4 changes: 0 additions & 4 deletions tools/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ endef
$(call allow-override,CC,$(CROSS_COMPILE)gcc)
$(call allow-override,LD,$(CROSS_COMPILE)ld)

HOSTCC ?= gcc
HOSTLD ?= ld
HOSTAR ?= ar

export HOSTCC HOSTLD HOSTAR

ifeq ($(V),1)
Expand Down
9 changes: 0 additions & 9 deletions tools/objtool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ include ../scripts/Makefile.include
include ../scripts/Makefile.arch

# always use the host compiler
ifneq ($(LLVM),)
HOSTAR ?= llvm-ar
HOSTCC ?= clang
HOSTLD ?= ld.lld
else
HOSTAR ?= ar
HOSTCC ?= gcc
HOSTLD ?= ld
endif
AR = $(HOSTAR)
CC = $(HOSTCC)
LD = $(HOSTLD)
Expand Down
4 changes: 0 additions & 4 deletions tools/perf/Makefile.perf
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ endef

LD += $(EXTRA_LDFLAGS)

HOSTCC ?= gcc
HOSTLD ?= ld
HOSTAR ?= ar

PKG_CONFIG = $(CROSS_COMPILE)pkg-config
LLVM_CONFIG ?= llvm-config

Expand Down
1 change: 0 additions & 1 deletion tools/power/acpi/Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM}
CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
CROSS_COMPILE ?= $(CROSS)
LD = $(CC)
HOSTCC = gcc

# check if compiler option is supported
cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}
Expand Down
10 changes: 10 additions & 0 deletions tools/scripts/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ $(call allow-override,LD,$(CROSS_COMPILE)ld)
$(call allow-override,CXX,$(CROSS_COMPILE)g++)
$(call allow-override,STRIP,$(CROSS_COMPILE)strip)

ifneq ($(LLVM),)
HOSTAR ?= llvm-ar
HOSTCC ?= clang
HOSTLD ?= ld.lld
else
HOSTAR ?= ar
HOSTCC ?= gcc
HOSTLD ?= ld
endif

ifeq ($(CC_NO_CLANG), 1)
EXTRA_WARNINGS += -Wstrict-aliasing=3
endif
Expand Down

0 comments on commit a972484

Please sign in to comment.