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 ...
Showing the changes to include/linux (3 of 96 files). Show all
Unified · Split
| @@ -130,10 +130,6 @@ struct ftrace_likely_data { · 129 unmodified lines | ||
| 130 | 130 | |
| 131 | 131 | /* |
| 132 | 132 | * 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. | |
| 137 | 133 | * Prefer gnu_inline, so that extern inline functions do not emit an |
| 138 | 134 | * externally visible function. This makes extern inline behave as per gnu89 |
| 139 | 135 | * semantics rather than c99. This prevents multiple symbol definition errors |
| @@ -144,15 +140,27 @@ struct ftrace_likely_data { · 4 unmodified lines | ||
| 144 | 140 | */ |
| 145 | 141 | #if !defined(CONFIG_OPTIMIZE_INLINING) |
| 146 | 142 | #define inline inline __attribute__((__always_inline__)) __gnu_inline \ |
| 147 | − __maybe_unused notrace | |
| 143 | + __inline_maybe_unused notrace | |
| 148 | 144 | #else |
| 149 | 145 | #define inline inline __gnu_inline \ |
| 150 | − __maybe_unused notrace | |
| 146 | + __inline_maybe_unused notrace | |
| 151 | 147 | #endif |
| 152 | 148 | |
| 153 | 149 | #define __inline__ inline |
| 154 | 150 | #define __inline inline |
| 155 | 151 | |
| 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 | + | |
| 156 | 164 | /* |
| 157 | 165 | * Rather then using noinline to prevent stack consumption, use |
| 158 | 166 | * noinline_for_stack instead. For documentation reasons. |
| @@ -18,9 +18,6 @@ extern struct module __this_module; · 17 unmodified lines | ||
| 18 | 18 | #define THIS_MODULE ((struct module *)0) |
| 19 | 19 | #endif |
| 20 | 20 | |
| 21 | −#ifdef CONFIG_MODULES | |
| 22 | − | |
| 23 | −#if defined(__KERNEL__) && !defined(__GENKSYMS__) | |
| 24 | 21 | #ifdef CONFIG_MODVERSIONS |
| 25 | 22 | /* Mark the CRC weak since genksyms apparently decides not to |
| 26 | 23 | * generate a checksums for some symbols */ |
| @@ -74,6 +71,12 @@ struct kernel_symbol { · 47 unmodified lines | ||
| 74 | 71 | }; |
| 75 | 72 | #endif |
| 76 | 73 | |
| 74 | +#ifdef __GENKSYMS__ | |
| 75 | + | |
| 76 | +#define ___EXPORT_SYMBOL(sym, sec) __GENKSYMS_EXPORT_SYMBOL(sym) | |
| 77 | + | |
| 78 | +#else | |
| 79 | + | |
| 77 | 80 | /* For every exported symbol, place a struct in the __ksymtab section */ |
| 78 | 81 | #define ___EXPORT_SYMBOL(sym, sec) \ |
| 79 | 82 | extern typeof(sym) sym; \ |
| @@ -83,7 +86,9 @@ struct kernel_symbol { · 3 unmodified lines | ||
| 83 | 86 | = #sym; \ |
| 84 | 87 | __KSYMTAB_ENTRY(sym, sec) |
| 85 | 88 | |
| 86 | −#if defined(__DISABLE_EXPORTS) | |
| 89 | +#endif | |
| 90 | + | |
| 91 | +#if !defined(CONFIG_MODULES) || defined(__DISABLE_EXPORTS) | |
| 87 | 92 | |
| 88 | 93 | /* |
| 89 | 94 | * Allow symbol exports to be disabled completely so that C code may |
| @@ -117,37 +122,22 @@ struct kernel_symbol { · 27 unmodified lines | ||
| 117 | 122 | #define __cond_export_sym_0(sym, sec) /* nothing */ |
| 118 | 123 | |
| 119 | 124 | #else |
| 120 | −#define __EXPORT_SYMBOL ___EXPORT_SYMBOL | |
| 121 | −#endif | |
| 122 | 125 | |
| 123 | −#define EXPORT_SYMBOL(sym) \ | |
| 124 | − __EXPORT_SYMBOL(sym, "") | |
| 126 | +#define __EXPORT_SYMBOL(sym, sec) ___EXPORT_SYMBOL(sym, sec) | |
| 125 | 127 | |
| 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 */ | |
| 131 | 129 | |
| 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") | |
| 132 | 133 | #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") | |
| 135 | 136 | #else |
| 136 | 137 | #define EXPORT_UNUSED_SYMBOL(sym) |
| 137 | 138 | #define EXPORT_UNUSED_SYMBOL_GPL(sym) |
| 138 | 139 | #endif |
| 139 | 140 | |
| 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 */ | |
| 151 | 141 | #endif /* !__ASSEMBLY__ */ |
| 152 | 142 | |
| 153 | 143 | #endif /* _LINUX_EXPORT_H */ |
| @@ -9,6 +9,8 @@ · 8 unmodified lines | ||
| 9 | 9 | #endif |
| 10 | 10 | #ifdef CONFIG_PREEMPT |
| 11 | 11 | #define MODULE_VERMAGIC_PREEMPT "preempt " |
| 12 | +#elif defined(CONFIG_PREEMPT_RT) | |
| 13 | +#define MODULE_VERMAGIC_PREEMPT "preempt_rt " | |
| 12 | 14 | #else |
| 13 | 15 | #define MODULE_VERMAGIC_PREEMPT "" |
| 14 | 16 | #endif |