提交 22d3e0c3 编写于 作者: L Linus Torvalds

Merge tag 'kbuild-fixes-v4.18' of...

Merge tag 'kbuild-fixes-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - introduce __diag_* macros and suppress -Wattribute-alias warnings
   from GCC 8

 - fix stack protector test script for x86_64

 - fix line number handling in Kconfig

 - document that '#' starts a comment in Kconfig

 - handle P_SYMBOL property in dump debugging of Kconfig

 - correct help message of LD_DEAD_CODE_DATA_ELIMINATION

 - fix occasional segmentation faults in Kconfig

* tag 'kbuild-fixes-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kconfig: loop boundary condition fix
  kbuild: reword help of LD_DEAD_CODE_DATA_ELIMINATION
  kconfig: handle P_SYMBOL in print_symbol()
  kconfig: document Kconfig source file comments
  kconfig: fix line numbers for if-entries in menu tree
  stack-protector: Fix test with 32-bit userland and CONFIG_64BIT=y
  powerpc: Remove -Wattribute-alias pragmas
  disable -Wattribute-alias warning for SYSCALL_DEFINEx()
  kbuild: add macro for controlling warnings to linux/compiler.h
...@@ -430,6 +430,12 @@ This sets the config program's title bar if the config program chooses ...@@ -430,6 +430,12 @@ This sets the config program's title bar if the config program chooses
to use it. It should be placed at the top of the configuration, before any to use it. It should be placed at the top of the configuration, before any
other statement. other statement.
'#' Kconfig source file comment:
An unquoted '#' character anywhere in a source file line indicates
the beginning of a source file comment. The remainder of that line
is a comment.
Kconfig hints Kconfig hints
------------- -------------
......
...@@ -285,9 +285,6 @@ pci_bus_to_hose(int bus) ...@@ -285,9 +285,6 @@ pci_bus_to_hose(int bus)
* Note that the returned IO or memory base is a physical address * Note that the returned IO or memory base is a physical address
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wattribute-alias"
SYSCALL_DEFINE3(pciconfig_iobase, long, which, SYSCALL_DEFINE3(pciconfig_iobase, long, which,
unsigned long, bus, unsigned long, devfn) unsigned long, bus, unsigned long, devfn)
{ {
...@@ -313,4 +310,3 @@ SYSCALL_DEFINE3(pciconfig_iobase, long, which, ...@@ -313,4 +310,3 @@ SYSCALL_DEFINE3(pciconfig_iobase, long, which,
return result; return result;
} }
#pragma GCC diagnostic pop
...@@ -203,9 +203,6 @@ void pcibios_setup_phb_io_space(struct pci_controller *hose) ...@@ -203,9 +203,6 @@ void pcibios_setup_phb_io_space(struct pci_controller *hose)
#define IOBASE_ISA_IO 3 #define IOBASE_ISA_IO 3
#define IOBASE_ISA_MEM 4 #define IOBASE_ISA_MEM 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wattribute-alias"
SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, in_bus, SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, in_bus,
unsigned long, in_devfn) unsigned long, in_devfn)
{ {
...@@ -259,7 +256,6 @@ SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, in_bus, ...@@ -259,7 +256,6 @@ SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, in_bus,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
#pragma GCC diagnostic pop
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
int pcibus_to_node(struct pci_bus *bus) int pcibus_to_node(struct pci_bus *bus)
......
...@@ -1051,9 +1051,6 @@ struct pseries_errorlog *get_pseries_errorlog(struct rtas_error_log *log, ...@@ -1051,9 +1051,6 @@ struct pseries_errorlog *get_pseries_errorlog(struct rtas_error_log *log,
} }
/* We assume to be passed big endian arguments */ /* We assume to be passed big endian arguments */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wattribute-alias"
SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs)
{ {
struct rtas_args args; struct rtas_args args;
...@@ -1140,7 +1137,6 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) ...@@ -1140,7 +1137,6 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs)
return 0; return 0;
} }
#pragma GCC diagnostic pop
/* /*
* Call early during boot, before mem init, to retrieve the RTAS * Call early during boot, before mem init, to retrieve the RTAS
......
...@@ -1038,9 +1038,6 @@ static int do_setcontext_tm(struct ucontext __user *ucp, ...@@ -1038,9 +1038,6 @@ static int do_setcontext_tm(struct ucontext __user *ucp,
} }
#endif #endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wattribute-alias"
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
COMPAT_SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx, COMPAT_SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
struct ucontext __user *, new_ctx, int, ctx_size) struct ucontext __user *, new_ctx, int, ctx_size)
...@@ -1134,7 +1131,6 @@ SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx, ...@@ -1134,7 +1131,6 @@ SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
set_thread_flag(TIF_RESTOREALL); set_thread_flag(TIF_RESTOREALL);
return 0; return 0;
} }
#pragma GCC diagnostic pop
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
COMPAT_SYSCALL_DEFINE0(rt_sigreturn) COMPAT_SYSCALL_DEFINE0(rt_sigreturn)
...@@ -1231,9 +1227,6 @@ SYSCALL_DEFINE0(rt_sigreturn) ...@@ -1231,9 +1227,6 @@ SYSCALL_DEFINE0(rt_sigreturn)
return 0; return 0;
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wattribute-alias"
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
SYSCALL_DEFINE3(debug_setcontext, struct ucontext __user *, ctx, SYSCALL_DEFINE3(debug_setcontext, struct ucontext __user *, ctx,
int, ndbg, struct sig_dbg_op __user *, dbg) int, ndbg, struct sig_dbg_op __user *, dbg)
...@@ -1337,7 +1330,6 @@ SYSCALL_DEFINE3(debug_setcontext, struct ucontext __user *, ctx, ...@@ -1337,7 +1330,6 @@ SYSCALL_DEFINE3(debug_setcontext, struct ucontext __user *, ctx,
return 0; return 0;
} }
#endif #endif
#pragma GCC diagnostic pop
/* /*
* OK, we're invoking a handler * OK, we're invoking a handler
......
...@@ -625,9 +625,6 @@ static long setup_trampoline(unsigned int syscall, unsigned int __user *tramp) ...@@ -625,9 +625,6 @@ static long setup_trampoline(unsigned int syscall, unsigned int __user *tramp)
/* /*
* Handle {get,set,swap}_context operations * Handle {get,set,swap}_context operations
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wattribute-alias"
SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx, SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
struct ucontext __user *, new_ctx, long, ctx_size) struct ucontext __user *, new_ctx, long, ctx_size)
{ {
...@@ -693,7 +690,6 @@ SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx, ...@@ -693,7 +690,6 @@ SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
set_thread_flag(TIF_RESTOREALL); set_thread_flag(TIF_RESTOREALL);
return 0; return 0;
} }
#pragma GCC diagnostic pop
/* /*
......
...@@ -62,9 +62,6 @@ static inline long do_mmap2(unsigned long addr, size_t len, ...@@ -62,9 +62,6 @@ static inline long do_mmap2(unsigned long addr, size_t len,
return ret; return ret;
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wattribute-alias"
SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len, SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
unsigned long, prot, unsigned long, flags, unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, pgoff) unsigned long, fd, unsigned long, pgoff)
...@@ -78,7 +75,6 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len, ...@@ -78,7 +75,6 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len,
{ {
return do_mmap2(addr, len, prot, flags, fd, offset, PAGE_SHIFT); return do_mmap2(addr, len, prot, flags, fd, offset, PAGE_SHIFT);
} }
#pragma GCC diagnostic pop
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
/* /*
......
...@@ -186,9 +186,6 @@ static void subpage_mark_vma_nohuge(struct mm_struct *mm, unsigned long addr, ...@@ -186,9 +186,6 @@ static void subpage_mark_vma_nohuge(struct mm_struct *mm, unsigned long addr,
* in a 2-bit field won't allow writes to a page that is otherwise * in a 2-bit field won't allow writes to a page that is otherwise
* write-protected. * write-protected.
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Wattribute-alias"
SYSCALL_DEFINE3(subpage_prot, unsigned long, addr, SYSCALL_DEFINE3(subpage_prot, unsigned long, addr,
unsigned long, len, u32 __user *, map) unsigned long, len, u32 __user *, map)
{ {
...@@ -272,4 +269,3 @@ SYSCALL_DEFINE3(subpage_prot, unsigned long, addr, ...@@ -272,4 +269,3 @@ SYSCALL_DEFINE3(subpage_prot, unsigned long, addr,
up_write(&mm->mmap_sem); up_write(&mm->mmap_sem);
return err; return err;
} }
#pragma GCC diagnostic pop
...@@ -72,6 +72,9 @@ ...@@ -72,6 +72,9 @@
*/ */
#ifndef COMPAT_SYSCALL_DEFINEx #ifndef COMPAT_SYSCALL_DEFINEx
#define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \
__diag_push(); \
__diag_ignore(GCC, 8, "-Wattribute-alias", \
"Type aliasing is used to sanitize syscall arguments");\
asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
__attribute__((alias(__stringify(__se_compat_sys##name)))); \ __attribute__((alias(__stringify(__se_compat_sys##name)))); \
...@@ -80,8 +83,11 @@ ...@@ -80,8 +83,11 @@
asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
{ \ { \
return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\ long ret = __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\
__MAP(x,__SC_TEST,__VA_ARGS__); \
return ret; \
} \ } \
__diag_pop(); \
static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
#endif /* COMPAT_SYSCALL_DEFINEx */ #endif /* COMPAT_SYSCALL_DEFINEx */
......
...@@ -347,3 +347,28 @@ ...@@ -347,3 +347,28 @@
#if GCC_VERSION >= 50100 #if GCC_VERSION >= 50100
#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
#endif #endif
/*
* Turn individual warnings and errors on and off locally, depending
* on version.
*/
#define __diag_GCC(version, severity, s) \
__diag_GCC_ ## version(__diag_GCC_ ## severity s)
/* Severity used in pragma directives */
#define __diag_GCC_ignore ignored
#define __diag_GCC_warn warning
#define __diag_GCC_error error
/* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */
#if GCC_VERSION >= 40600
#define __diag_str1(s) #s
#define __diag_str(s) __diag_str1(s)
#define __diag(s) _Pragma(__diag_str(GCC diagnostic s))
#endif
#if GCC_VERSION >= 80000
#define __diag_GCC_8(s) __diag(s)
#else
#define __diag_GCC_8(s)
#endif
...@@ -271,4 +271,22 @@ struct ftrace_likely_data { ...@@ -271,4 +271,22 @@ struct ftrace_likely_data {
# define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) # define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
#endif #endif
#ifndef __diag
#define __diag(string)
#endif
#ifndef __diag_GCC
#define __diag_GCC(version, severity, string)
#endif
#define __diag_push() __diag(push)
#define __diag_pop() __diag(pop)
#define __diag_ignore(compiler, version, option, comment) \
__diag_ ## compiler(version, ignore, option)
#define __diag_warn(compiler, version, option, comment) \
__diag_ ## compiler(version, warn, option)
#define __diag_error(compiler, version, option, comment) \
__diag_ ## compiler(version, error, option)
#endif /* __LINUX_COMPILER_TYPES_H */ #endif /* __LINUX_COMPILER_TYPES_H */
...@@ -231,6 +231,9 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event) ...@@ -231,6 +231,9 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
*/ */
#ifndef __SYSCALL_DEFINEx #ifndef __SYSCALL_DEFINEx
#define __SYSCALL_DEFINEx(x, name, ...) \ #define __SYSCALL_DEFINEx(x, name, ...) \
__diag_push(); \
__diag_ignore(GCC, 8, "-Wattribute-alias", \
"Type aliasing is used to sanitize syscall arguments");\
asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
__attribute__((alias(__stringify(__se_sys##name)))); \ __attribute__((alias(__stringify(__se_sys##name)))); \
ALLOW_ERROR_INJECTION(sys##name, ERRNO); \ ALLOW_ERROR_INJECTION(sys##name, ERRNO); \
...@@ -243,6 +246,7 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event) ...@@ -243,6 +246,7 @@ static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
__PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
return ret; \ return ret; \
} \ } \
__diag_pop(); \
static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
#endif /* __SYSCALL_DEFINEx */ #endif /* __SYSCALL_DEFINEx */
......
...@@ -1051,10 +1051,9 @@ config LD_DEAD_CODE_DATA_ELIMINATION ...@@ -1051,10 +1051,9 @@ config LD_DEAD_CODE_DATA_ELIMINATION
depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
depends on EXPERT depends on EXPERT
help help
Select this if the architecture wants to do dead code and Enable this if you want to do dead code and data elimination with
data elimination with the linker by compiling with the linker by compiling with -ffunction-sections -fdata-sections,
-ffunction-sections -fdata-sections, and linking with and linking with --gc-sections.
--gc-sections.
This can reduce on disk and in-memory size of the kernel This can reduce on disk and in-memory size of the kernel
code and static data, particularly for small configs and code and static data, particularly for small configs and
......
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -mcmodel=kernel -fno-PIE -fstack-protector - -o - 2> /dev/null | grep -q "%gs" echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -m64 -O0 -mcmodel=kernel -fno-PIE -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
...@@ -171,6 +171,9 @@ struct symbol { ...@@ -171,6 +171,9 @@ struct symbol {
* config BAZ * config BAZ
* int "BAZ Value" * int "BAZ Value"
* range 1..255 * range 1..255
*
* Please, also check zconf.y:print_symbol() when modifying the
* list of property types!
*/ */
enum prop_type { enum prop_type {
P_UNKNOWN, P_UNKNOWN,
......
...@@ -156,7 +156,7 @@ static char *do_shell(int argc, char *argv[]) ...@@ -156,7 +156,7 @@ static char *do_shell(int argc, char *argv[])
nread--; nread--;
/* remove trailing new lines */ /* remove trailing new lines */
while (buf[nread - 1] == '\n') while (nread > 0 && buf[nread - 1] == '\n')
nread--; nread--;
buf[nread] = 0; buf[nread] = 0;
......
...@@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE]; ...@@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE];
static struct menu *current_menu, *current_entry; static struct menu *current_menu, *current_entry;
%} %}
%expect 32 %expect 31
%union %union
{ {
...@@ -337,7 +337,7 @@ choice_block: ...@@ -337,7 +337,7 @@ choice_block:
/* if entry */ /* if entry */
if_entry: T_IF expr nl if_entry: T_IF expr T_EOL
{ {
printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
menu_add_entry(NULL); menu_add_entry(NULL);
...@@ -717,6 +717,10 @@ static void print_symbol(FILE *out, struct menu *menu) ...@@ -717,6 +717,10 @@ static void print_symbol(FILE *out, struct menu *menu)
print_quoted_string(out, prop->text); print_quoted_string(out, prop->text);
fputc('\n', out); fputc('\n', out);
break; break;
case P_SYMBOL:
fputs( " symbol ", out);
fprintf(out, "%s\n", prop->sym->name);
break;
default: default:
fprintf(out, " unknown prop %d!\n", prop->type); fprintf(out, " unknown prop %d!\n", prop->type);
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册