Skip to content

Commit 1c8594b

Browse files
committed
Merge tag 'kbuild-fixes-v5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild into master
Pull Kbuild fixes from Masahiro Yamada: - do not use non-portable strsep() in a host program - fix single target builds for external modules - change Clang's --prefix option to make it work for the latest Clang * tag 'kbuild-fixes-v5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation kbuild: fix single target builds for external modules modpost: remove use of non-standard strsep() in HOSTCC code
2 parents 40c60ac + ca9b31f commit 1c8594b

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
567567
ifneq ($(CROSS_COMPILE),)
568568
CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%))
569569
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
570-
CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
570+
CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
571571
GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
572572
endif
573573
ifneq ($(GCC_TOOLCHAIN),)
@@ -1754,7 +1754,7 @@ PHONY += descend $(build-dirs)
17541754
descend: $(build-dirs)
17551755
$(build-dirs): prepare
17561756
$(Q)$(MAKE) $(build)=$@ \
1757-
single-build=$(if $(filter-out $@/, $(filter $@/%, $(single-no-ko))),1) \
1757+
single-build=$(if $(filter-out $@/, $(filter $@/%, $(KBUILD_SINGLE_TARGETS))),1) \
17581758
need-builtin=1 need-modorder=1
17591759

17601760
clean-dirs := $(addprefix _clean_, $(clean-dirs))

scripts/mod/modpost.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,19 @@ char *read_text_file(const char *filename)
138138

139139
char *get_line(char **stringp)
140140
{
141+
char *orig = *stringp, *next;
142+
141143
/* do not return the unwanted extra line at EOF */
142-
if (*stringp && **stringp == '\0')
144+
if (!orig || *orig == '\0')
143145
return NULL;
144146

145-
return strsep(stringp, "\n");
147+
next = strchr(orig, '\n');
148+
if (next)
149+
*next++ = '\0';
150+
151+
*stringp = next;
152+
153+
return orig;
146154
}
147155

148156
/* A list of all modules we processed */

0 commit comments

Comments
 (0)