Skip to content

Commit d4a74bb

Browse files
committed
kbuild: use -- separater intead of $(filter-out ...) for cc-cross-prefix
arch/mips/Makefile passes prefixes that start with '-' to cc-cross-prefix when $(tool-archpref) evaluates to the empty string. They are filtered-out before the $(shell ...) invocation. Otherwise, 'command -v' would be confused. $ command -v -linux-gcc bash: command: -l: invalid option command: usage: command [-pVv] command [arg ...] Since commit 913ab97 ("kbuild: use more portable 'command -v' for cc-cross-prefix"), cc-cross-prefix throws away the stderr output, so the console is not polluted in any way. This is not a big deal in practice, but I see a slightly better taste in adding '--' to teach it that '-linux-gcc' is an argument instead of a command option. This will cause extra forking of subshell, but it will not be noticeable performance regression. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent 3a475b2 commit d4a74bb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎scripts/Kbuild.include‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ endef
7979
# would try to directly execute the shell builtin 'command'. This workaround
8080
# should be kept for a long time since this issue was fixed only after the
8181
# GNU Make 4.2.1 release.
82-
cc-cross-prefix = $(firstword $(foreach c, $(filter-out -%, $(1)), \
83-
$(if $(shell command -v $(c)gcc 2>/dev/null), $(c))))
82+
cc-cross-prefix = $(firstword $(foreach c, $(1), \
83+
$(if $(shell command -v -- $(c)gcc 2>/dev/null), $(c))))
8484

8585
# output directory for tests below
8686
TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)

0 commit comments

Comments
 (0)