Skip to content

Commit 54c2c9d

Browse files
committed
LoongArch: Only fiddle with CHECKFLAGS if `need-compiler'
This is a port of commit 4fe4a63 ("MIPS: Only fiddle with CHECKFLAGS if `need-compiler'") to LoongArch. We have originally guarded fiddling with CHECKFLAGS in our arch Makefile by checking for the CONFIG_LOONGARCH variable, not set for targets such as `distclean', etc. that neither include `.config' nor use the compiler. Starting from commit 805b2e1 ("kbuild: include Makefile.compiler only when compiler is needed") we have had a generic `need-compiler' variable explicitly telling us if the compiler will be used and thus its capabilities need to be checked and expressed in the form of compilation flags. If this variable is not set, then `make' functions such as `cc-option' are undefined, causing all kinds of weirdness to happen if we expect specific results to be returned. It doesn't cause problems on LoongArch now. But as a guard we replace the check for CONFIG_LOONGARCH with one for `need-compiler' instead, so as to prevent the compiler from being ever called for CHECKFLAGS when not needed. Signed-off-by: Huacai Chen <[email protected]>
1 parent 6eaae19 commit 54c2c9d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/loongarch/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ KBUILD_CFLAGS += -isystem $(shell $(CC) -print-file-name=include)
111111

112112
KBUILD_LDFLAGS += -m $(ld-emul)
113113

114-
ifdef CONFIG_LOONGARCH
114+
ifdef need-compiler
115115
CHECKFLAGS += $(shell $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
116116
grep -E -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \
117117
sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')

0 commit comments

Comments
 (0)