History

Merge tag 'kbuild-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild updates from Masahiro Yamada: - add modpost warn exported symbols marked as 'static' because 'static' and EXPORT_SYMBOL is an odd combination - break the build early if gold linker is used - optimize the Bison rule to produce .c and .h files by a single pattern rule - handle PREEMPT_RT in the module vermagic and UTS_VERSION - warn CONFIG options leaked to the user-space except existing ones - make single targets work properly - rebuild modules when module linker scripts are updated - split the module final link stage into scripts/Makefile.modfinal - fix the missed error code in merge_config.sh - improve the error message displayed on the attempt of the O= build in unclean source tree - remove 'clean-dirs' syntax - disable -Wimplicit-fallthrough warning for Clang - add CONFIG_CC_OPTIMIZE_FOR_SIZE_O3 for ARC - remove ARCH_{CPP,A,C}FLAGS variables - add $(BASH) to run bash scripts - change *CFLAGS_<basetarget>.o to take the relative path to $(obj) instead of the basename - stop suppressing Clang's -Wunused-function warnings when W=1 - fix linux/export.h to avoid genksyms calculating CRC of trimmed exported symbols - misc cleanups * tag 'kbuild-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (63 commits) genksyms: convert to SPDX License Identifier for lex.l and parse.y modpost: use __section in the output to *.mod.c modpost: use MODULE_INFO() for __module_depends export.h, genksyms: do not make genksyms calculate CRC of trimmed symbols export.h: remove defined(__KERNEL__), which is no longer needed kbuild: allow Clang to find unused static inline functions for W=1 build kbuild: rename KBUILD_ENABLE_EXTRA_GCC_CHECKS to KBUILD_EXTRA_WARN kbuild: refactor scripts/Makefile.extrawarn merge_config.sh: ignore unwanted grep errors kbuild: change *FLAGS_<basetarget>.o to take the path relative to $(obj) modpost: add NOFAIL to strndup modpost: add guid_t type definition kbuild: add $(BASH) to run scripts with bash-extension kbuild: remove ARCH_{CPP,A,C}FLAGS kbuild,arc: add CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 for ARC kbuild: Do not enable -Wimplicit-fallthrough for clang for now kbuild: clean up subdir-ymn calculation in Makefile.clean kbuild: remove unneeded '+' marker from cmd_clean kbuild: remove clean-dirs syntax kbuild: check clean srctree even earlier ...

Linus Torvalds committed 7 years ago

Commit d7b08272 parents 574cc45 77564a496 files · +763 −686Browse files

Showing the changes to include/linux (3 of 96 files). Show all

Unified · Split

3 files
  1. include/linux/compiler_types.h +14 −6
  2. include/linux/export.h +16 −26
  3. include/linux/vermagic.h +2 −0
include/linux/compiler_types.h+14−6
@@ -130,10 +130,6 @@ struct ftrace_likely_data { · 129 unmodified lines
130130
131131 /*
132132 * Force always-inline if the user requests it so via the .config.
133− * GCC does not warn about unused static inline functions for
134− * -Wunused-function. This turns out to avoid the need for complex #ifdef
135− * directives. Suppress the warning in clang as well by using "unused"
136− * function attribute, which is redundant but not harmful for gcc.
137133 * Prefer gnu_inline, so that extern inline functions do not emit an
138134 * externally visible function. This makes extern inline behave as per gnu89
139135 * semantics rather than c99. This prevents multiple symbol definition errors
@@ -144,15 +140,27 @@ struct ftrace_likely_data { · 4 unmodified lines
144140 */
145141 #if !defined(CONFIG_OPTIMIZE_INLINING)
146142 #define inline inline __attribute__((__always_inline__)) __gnu_inline \
147− __maybe_unused notrace
143+ __inline_maybe_unused notrace
148144 #else
149145 #define inline inline __gnu_inline \
150− __maybe_unused notrace
146+ __inline_maybe_unused notrace
151147 #endif
152148
153149 #define __inline__ inline
154150 #define __inline inline
155151
152+/*
153+ * GCC does not warn about unused static inline functions for -Wunused-function.
154+ * Suppress the warning in clang as well by using __maybe_unused, but enable it
155+ * for W=1 build. This will allow clang to find unused functions. Remove the
156+ * __inline_maybe_unused entirely after fixing most of -Wunused-function warnings.
157+ */
158+#ifdef KBUILD_EXTRA_WARN1
159+#define __inline_maybe_unused
160+#else
161+#define __inline_maybe_unused __maybe_unused
162+#endif
163+
156164 /*
157165 * Rather then using noinline to prevent stack consumption, use
158166 * noinline_for_stack instead. For documentation reasons.
include/linux/export.h+16−26
@@ -18,9 +18,6 @@ extern struct module __this_module; · 17 unmodified lines
1818 #define THIS_MODULE ((struct module *)0)
1919 #endif
2020
21−#ifdef CONFIG_MODULES
22−
23−#if defined(__KERNEL__) && !defined(__GENKSYMS__)
2421 #ifdef CONFIG_MODVERSIONS
2522 /* Mark the CRC weak since genksyms apparently decides not to
2623 * generate a checksums for some symbols */
@@ -74,6 +71,12 @@ struct kernel_symbol { · 47 unmodified lines
7471 };
7572 #endif
7673
74+#ifdef __GENKSYMS__
75+
76+#define ___EXPORT_SYMBOL(sym, sec) __GENKSYMS_EXPORT_SYMBOL(sym)
77+
78+#else
79+
7780 /* For every exported symbol, place a struct in the __ksymtab section */
7881 #define ___EXPORT_SYMBOL(sym, sec) \
7982 extern typeof(sym) sym; \
@@ -83,7 +86,9 @@ struct kernel_symbol { · 3 unmodified lines
8386 = #sym; \
8487 __KSYMTAB_ENTRY(sym, sec)
8588
86−#if defined(__DISABLE_EXPORTS)
89+#endif
90+
91+#if !defined(CONFIG_MODULES) || defined(__DISABLE_EXPORTS)
8792
8893 /*
8994 * Allow symbol exports to be disabled completely so that C code may
@@ -117,37 +122,22 @@ struct kernel_symbol { · 27 unmodified lines
117122 #define __cond_export_sym_0(sym, sec) /* nothing */
118123
119124 #else
120−#define __EXPORT_SYMBOL ___EXPORT_SYMBOL
121−#endif
122125
123−#define EXPORT_SYMBOL(sym) \
124− __EXPORT_SYMBOL(sym, "")
126+#define __EXPORT_SYMBOL(sym, sec) ___EXPORT_SYMBOL(sym, sec)
125127
126−#define EXPORT_SYMBOL_GPL(sym) \
127− __EXPORT_SYMBOL(sym, "_gpl")
128−
129−#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
130− __EXPORT_SYMBOL(sym, "_gpl_future")
128+#endif /* CONFIG_MODULES */
131129
130+#define EXPORT_SYMBOL(sym) __EXPORT_SYMBOL(sym, "")
131+#define EXPORT_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_gpl")
132+#define EXPORT_SYMBOL_GPL_FUTURE(sym) __EXPORT_SYMBOL(sym, "_gpl_future")
132133 #ifdef CONFIG_UNUSED_SYMBOLS
133−#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
134−#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
134+#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
135+#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
135136 #else
136137 #define EXPORT_UNUSED_SYMBOL(sym)
137138 #define EXPORT_UNUSED_SYMBOL_GPL(sym)
138139 #endif
139140
140−#endif /* __GENKSYMS__ */
141−
142−#else /* !CONFIG_MODULES... */
143−
144−#define EXPORT_SYMBOL(sym)
145−#define EXPORT_SYMBOL_GPL(sym)
146−#define EXPORT_SYMBOL_GPL_FUTURE(sym)
147−#define EXPORT_UNUSED_SYMBOL(sym)
148−#define EXPORT_UNUSED_SYMBOL_GPL(sym)
149−
150−#endif /* CONFIG_MODULES */
151141 #endif /* !__ASSEMBLY__ */
152142
153143 #endif /* _LINUX_EXPORT_H */
include/linux/vermagic.h+2−0
@@ -9,6 +9,8 @@ · 8 unmodified lines
99 #endif
1010 #ifdef CONFIG_PREEMPT
1111 #define MODULE_VERMAGIC_PREEMPT "preempt "
12+#elif defined(CONFIG_PREEMPT_RT)
13+#define MODULE_VERMAGIC_PREEMPT "preempt_rt "
1214 #else
1315 #define MODULE_VERMAGIC_PREEMPT ""
1416 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t