Skip to content

Commit 2162b80

Browse files
committed
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild updates from Michal Marek: - make dtbs_install fix - Error handling fix fixdep and link-vmlinux.sh - __UNIQUE_ID fix for clang - Fix for if_changed_* to suppress the "is up to date." message - The kernel is built with -Werror=incompatible-pointer-types * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: kbuild: Add option to turn incompatible pointer check into error kbuild: suppress annoying "... is up to date." message kbuild: fixdep: Check fstat(2) return value scripts/link-vmlinux.sh: force error on kallsyms failure Kbuild: provide a __UNIQUE_ID for clang dtbsinstall: don't move target directory out of the way
2 parents 976fb3f + ea8daa7 commit 2162b80

6 files changed

Lines changed: 20 additions & 9 deletions

File tree

‎Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,9 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=strict-prototypes)
782782
# Prohibit date/time macros, which would make the build non-deterministic
783783
KBUILD_CFLAGS += $(call cc-option,-Werror=date-time)
784784

785+
# enforce correct pointer usage
786+
KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types)
787+
785788
# use the deterministic mode of AR if available
786789
KBUILD_ARFLAGS := $(call ar-option,D)
787790

‎include/linux/compiler-clang.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@
1010
#undef uninitialized_var
1111
#define uninitialized_var(x) x = *(&(x))
1212
#endif
13+
14+
/* same as gcc, this was present in clang-2.6 so we can assume it works
15+
* with any version that can compile the kernel
16+
*/
17+
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)

‎scripts/Kbuild.include‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,22 +251,22 @@ any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
251251
if_changed = $(if $(strip $(any-prereq) $(arg-check)), \
252252
@set -e; \
253253
$(echo-cmd) $(cmd_$(1)); \
254-
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
254+
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
255255

256256
# Execute the command and also postprocess generated .d dependencies file.
257257
if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \
258258
@set -e; \
259259
$(echo-cmd) $(cmd_$(1)); \
260260
scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\
261261
rm -f $(depfile); \
262-
mv -f $(dot-target).tmp $(dot-target).cmd)
262+
mv -f $(dot-target).tmp $(dot-target).cmd, @:)
263263

264264
# Usage: $(call if_changed_rule,foo)
265265
# Will check if $(cmd_foo) or any of the prerequisites changed,
266266
# and if so will execute $(rule_foo).
267267
if_changed_rule = $(if $(strip $(any-prereq) $(arg-check) ), \
268268
@set -e; \
269-
$(rule_$(1)))
269+
$(rule_$(1)), @:)
270270

271271
###
272272
# why - tell why a a target got build

‎scripts/Makefile.dtbinst‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ include $(src)/Makefile
2323
PHONY += __dtbs_install_prep
2424
__dtbs_install_prep:
2525
ifeq ("$(dtbinst-root)", "$(obj)")
26-
$(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi
27-
$(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi
2826
$(Q)mkdir -p $(INSTALL_DTBS_PATH)
2927
endif
3028

‎scripts/basic/fixdep.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ static void do_config_file(const char *filename)
274274
perror(filename);
275275
exit(2);
276276
}
277-
fstat(fd, &st);
277+
if (fstat(fd, &st) < 0) {
278+
fprintf(stderr, "fixdep: error fstat'ing config file: ");
279+
perror(filename);
280+
exit(2);
281+
}
278282
if (st.st_size == 0) {
279283
close(fd);
280284
return;

‎scripts/link-vmlinux.sh‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,10 @@ kallsyms()
9797
local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
9898
${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
9999

100-
${NM} -n ${1} | \
101-
scripts/kallsyms ${kallsymopt} | \
102-
${CC} ${aflags} -c -o ${2} -x assembler-with-cpp -
100+
local afile="`basename ${2} .o`.S"
101+
102+
${NM} -n ${1} | scripts/kallsyms ${kallsymopt} > ${afile}
103+
${CC} ${aflags} -c -o ${2} ${afile}
103104
}
104105

105106
# Create map file with all symbols from ${1}

0 commit comments

Comments
 (0)