objtool: Allow AR to be overridden with HOSTAR
PATCH 1/1 objtool: Allow AR to be overridden with HOSTAR
Currently, this Makefile hardcodes GNU ar, meaning that if it is not available, there is no way to supply a different one and the build will fail.
$ make AR=llvm-ar CC=clang LD=ld.lld HOSTAR=llvm-ar HOSTCC=clang \
HOSTLD=ld.lld HOSTLDFLAGS=-fuse-ld=lld defconfig modules_prepare
...
AR /out/tools/objtool/libsubcmd.a
/bin/sh: 1: ar: not found
...Follow the logic of HOST{CC,LD} and allow the user to specify a different ar tool via HOSTAR (which is used elsewhere in other tools/ Makefiles).
--- tools/objtool/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/objtool/Makefile +2 -1
@@ -7,11 +7,12 @@ ARCH := x86 endif # always use the host compiler +HOSTAR ?= ar HOSTCC ?= gcc HOSTLD ?= ld +AR = $(HOSTAR) CC = $(HOSTCC) LD = $(HOSTLD) -AR = ar ifeq ($(srctree),) srctree := $(patsubst %/,%,$(dir $(CURDIR)))
Signature · 1 line
2.22.0.rc0
.On Tue, May 14, 2019 at 3:41 PM Nathan Chancellor
Quoted 27 lines · <[email protected]> wrote:
Currently, this
Makefilehardcodes GNU ar, meaning that if it is not available, there is no way to supply a different one and the build will fail.$ make AR=llvm-ar CC=clang LD=ld.lld HOSTAR=llvm-ar HOSTCC=clang \ HOSTLD=ld.lld HOSTLDFLAGS=-fuse-ld=lld defconfig modules_prepare ... AR /out/tools/objtool/libsubcmd.a /bin/sh: 1: ar: not found ...Follow the logic of HOST{CC,LD} and allow the user to specify a different ar tool via HOSTAR (which is used elsewhere in other
tools/Makefiles).Signed-off-by Nathan Chancellor <[email protected]>--- tools/objtool/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/objtool/Makefile +0
-0
tools/objtool/Makefile ARCH := x86 · line 14
Quoted 10 lines
tools/objtool/Makefile +2
-1@@ -7,11 +7,12 @@ ARCH := x86 endif # always use the host compiler +HOSTAR ?= ar HOSTCC ?= gcc HOSTLD ?= ld +AR = $(HOSTAR) CC = $(HOSTCC) LD = $(HOSTLD) -AR = ar
+ Kbuild
Seems to match what's going on in tools/perf/Makefile.perf and tools/build/Makefile. Thanks for the patch!
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 11 lines · Nathan Chancellor
Currently, this
Makefilehardcodes GNU ar, meaning that if it is not available, there is no way to supply a different one and the build will fail.$ make AR=llvm-ar CC=clang LD=ld.lld HOSTAR=llvm-ar HOSTCC=clang \ HOSTLD=ld.lld HOSTLDFLAGS=-fuse-ld=lld defconfig modules_prepare ... AR /out/tools/objtool/libsubcmd.a /bin/sh: 1: ar: not found ...
Quoted 6 lines
Follow the logic of HOST{CC,LD} and allow the user to specify a different ar tool via HOSTAR (which is used elsewhere in other
tools/Makefiles).
Nice catch.
Cheers,
-Mukesh
Quoted 22 lines
--- tools/objtool/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/objtool/Makefile +2
-1@@ -7,11 +7,12 @@ ARCH := x86 endif # always use the host compiler +HOSTAR ?= ar HOSTCC ?= gcc HOSTLD ?= ld +AR = $(HOSTAR) CC = $(HOSTCC) LD = $(HOSTLD) -AR = ar ifeq ($(srctree),) srctree := $(patsubst %/,%,$(dir $(CURDIR)))
Quoted 11 lines · Nathan Chancellor
Currently, this
Makefilehardcodes GNU ar, meaning that if it is not available, there is no way to supply a different one and the build will fail.$ make AR=llvm-ar CC=clang LD=ld.lld HOSTAR=llvm-ar HOSTCC=clang \ HOSTLD=ld.lld HOSTLDFLAGS=-fuse-ld=lld defconfig modules_prepare ... AR /out/tools/objtool/libsubcmd.a /bin/sh: 1: ar: not found ...
Quoted 6 lines
Follow the logic of HOST{CC,LD} and allow the user to specify a different ar tool via HOSTAR (which is used elsewhere in other
tools/Makefiles).
Thanks Nathan. I'll send it along to the tip tree.
Signature · 1 line
Josh