Skip to content

Commit

Permalink
Merge tag 'kbuild-fixes-v5.8-3' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
torvalds committed Jul 26, 2020
2 parents 40c60ac + ca9b31f commit 1c8594b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
ifneq ($(CROSS_COMPILE),)
CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%))
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
endif
ifneq ($(GCC_TOOLCHAIN),)
Expand Down Expand Up @@ -1754,7 +1754,7 @@ PHONY += descend $(build-dirs)
descend: $(build-dirs)
$(build-dirs): prepare
$(Q)$(MAKE) $(build)=$@ \
single-build=$(if $(filter-out $@/, $(filter $@/%, $(single-no-ko))),1) \
single-build=$(if $(filter-out $@/, $(filter $@/%, $(KBUILD_SINGLE_TARGETS))),1) \
need-builtin=1 need-modorder=1

clean-dirs := $(addprefix _clean_, $(clean-dirs))
Expand Down
12 changes: 10 additions & 2 deletions scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,19 @@ char *read_text_file(const char *filename)

char *get_line(char **stringp)
{
char *orig = *stringp, *next;

/* do not return the unwanted extra line at EOF */
if (*stringp && **stringp == '\0')
if (!orig || *orig == '\0')
return NULL;

return strsep(stringp, "\n");
next = strchr(orig, '\n');
if (next)
*next++ = '\0';

*stringp = next;

return orig;
}

/* A list of all modules we processed */
Expand Down

0 comments on commit 1c8594b

Please sign in to comment.