diff mbox

kbuild: Remove stale asm-generic wrappers

Message ID 1453199503-30900-1-git-send-email-james.hogan@imgtec.com (mailing list archive)
State New, archived
Headers show

Commit Message

James Hogan Jan. 19, 2016, 10:31 a.m. UTC
When a header file is removed from generic-y (often accompanied by the
addition of an arch specific header), the generated wrapper file will
persist, and in some cases may still take precedence over the new arch
header.

For example commit f1fe2d21f4e1 ("MIPS: Add definitions for extended
context") removed ucontext.h from generic-y in arch/mips/include/asm/,
and added an arch/mips/include/uapi/asm/ucontext.h. The continued use of
the wrapper when reusing a dirty build tree resulted in build failures
in arch/mips/kernel/signal.c:

arch/mips/kernel/signal.c: In function ‘sc_to_extcontext’:
arch/mips/kernel/signal.c:142:12: error: ‘struct ucontext’ has no member named ‘uc_extcontext’
  return &uc->uc_extcontext;
            ^

Fix by detecting wrapper headers in generated header directories that do
not correspond to a filename in generic-y, and removing them.

Reported-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Reported-by: Hauke Mehrtens <hauke@hauke-m.de>
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Michal Marek <mmarek@suse.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-kbuild@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: linux-mips@linux-mips.org
---
 scripts/Makefile.asm-generic | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

kernel test robot Jan. 19, 2016, 10:42 a.m. UTC | #1
Hi James,

[auto build test ERROR on kbuild/for-next]
[also build test ERROR on v4.4 next-20160119]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/James-Hogan/kbuild-Remove-stale-asm-generic-wrappers/20160119-183642
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git for-next
config: i386-tinyconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from arch/x86/kernel/asm-offsets.c:25:0:
>> arch/x86/kernel/asm-offsets_32.c:12:29: fatal error: asm/syscalls_32.h: No such file or directory
   compilation terminated.
   make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +12 arch/x86/kernel/asm-offsets_32.c

5de2b61a6 arch/x86/kernel/asm-offsets_32.c  Borislav Petkov 2014-12-09   1  #ifndef __LINUX_KBUILD_H
5de2b61a6 arch/x86/kernel/asm-offsets_32.c  Borislav Petkov 2014-12-09   2  # error "Please do not build this file directly, build asm-offsets.c instead"
5de2b61a6 arch/x86/kernel/asm-offsets_32.c  Borislav Petkov 2014-12-09   3  #endif
5de2b61a6 arch/x86/kernel/asm-offsets_32.c  Borislav Petkov 2014-12-09   4  
8d0d37cfb arch/i386/kernel/asm-offsets_32.c Thomas Gleixner 2007-10-11   5  #include <asm/ucontext.h>
8d0d37cfb arch/i386/kernel/asm-offsets_32.c Thomas Gleixner 2007-10-11   6  
8d0d37cfb arch/i386/kernel/asm-offsets_32.c Thomas Gleixner 2007-10-11   7  #include <linux/lguest.h>
8d0d37cfb arch/i386/kernel/asm-offsets_32.c Thomas Gleixner 2007-10-11   8  #include "../../../drivers/lguest/lg.h"
8d0d37cfb arch/i386/kernel/asm-offsets_32.c Thomas Gleixner 2007-10-11   9  
303395ac3 arch/x86/kernel/asm-offsets_32.c  H. Peter Anvin  2011-11-11  10  #define __SYSCALL_I386(nr, sym, compat) [nr] = 1,
303395ac3 arch/x86/kernel/asm-offsets_32.c  H. Peter Anvin  2011-11-11  11  static char syscalls[] = {
303395ac3 arch/x86/kernel/asm-offsets_32.c  H. Peter Anvin  2011-11-11 @12  #include <asm/syscalls_32.h>
303395ac3 arch/x86/kernel/asm-offsets_32.c  H. Peter Anvin  2011-11-11  13  };
303395ac3 arch/x86/kernel/asm-offsets_32.c  H. Peter Anvin  2011-11-11  14  
8d0d37cfb arch/i386/kernel/asm-offsets_32.c Thomas Gleixner 2007-10-11  15  /* workaround for a warning with -Wmissing-prototypes */
8d0d37cfb arch/i386/kernel/asm-offsets_32.c Thomas Gleixner 2007-10-11  16  void foo(void);
8d0d37cfb arch/i386/kernel/asm-offsets_32.c Thomas Gleixner 2007-10-11  17  
8d0d37cfb arch/i386/kernel/asm-offsets_32.c Thomas Gleixner 2007-10-11  18  void foo(void)
8d0d37cfb arch/i386/kernel/asm-offsets_32.c Thomas Gleixner 2007-10-11  19  {
8d0d37cfb arch/i386/kernel/asm-offsets_32.c Thomas Gleixner 2007-10-11  20  	OFFSET(CPUINFO_x86, cpuinfo_x86, x86);

:::::: The code at line 12 was first introduced by commit
:::::: 303395ac3bf3e2cb488435537d416bc840438fcb x86: Generate system call tables and unistd_*.h from tables

:::::: TO: H. Peter Anvin <hpa@linux.intel.com>
:::::: CC: H. Peter Anvin <hpa@linux.intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Jan. 19, 2016, 11:04 a.m. UTC | #2
Hi James,

[auto build test ERROR on kbuild/for-next]
[also build test ERROR on v4.4 next-20160119]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/James-Hogan/kbuild-Remove-stale-asm-generic-wrappers/20160119-183642
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git for-next
config: i386-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from arch/x86/include/asm/seccomp.h:4:0,
                    from include/linux/seccomp.h:11,
                    from include/linux/sched.h:44,
                    from include/linux/uaccess.h:4,
                    from include/linux/crypto.h:26,
                    from arch/x86/kernel/asm-offsets.c:8:
>> arch/x86/include/asm/unistd.h:15:29: fatal error: asm/unistd_32.h: No such file or directory
   compilation terminated.
   make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +15 arch/x86/include/asm/unistd.h

303395ac arch/x86/include/asm/unistd.h H. Peter Anvin 2011-11-11   1  #ifndef _ASM_X86_UNISTD_H
303395ac arch/x86/include/asm/unistd.h H. Peter Anvin 2011-11-11   2  #define _ASM_X86_UNISTD_H 1
303395ac arch/x86/include/asm/unistd.h H. Peter Anvin 2011-11-11   3  
af170c50 arch/x86/include/asm/unistd.h David Howells  2012-12-14   4  #include <uapi/asm/unistd.h>
6cbb369f arch/x86/include/asm/unistd.h H. Peter Anvin 2012-02-14   5  
fca460f9 arch/x86/include/asm/unistd.h H. Peter Anvin 2012-02-19   6  
fca460f9 arch/x86/include/asm/unistd.h H. Peter Anvin 2012-02-19   7  # ifdef CONFIG_X86_X32_ABI
fca460f9 arch/x86/include/asm/unistd.h H. Peter Anvin 2012-02-19   8  #  define __SYSCALL_MASK (~(__X32_SYSCALL_BIT))
fca460f9 arch/x86/include/asm/unistd.h H. Peter Anvin 2012-02-19   9  # else
fca460f9 arch/x86/include/asm/unistd.h H. Peter Anvin 2012-02-19  10  #  define __SYSCALL_MASK (~0)
fca460f9 arch/x86/include/asm/unistd.h H. Peter Anvin 2012-02-19  11  # endif
fca460f9 arch/x86/include/asm/unistd.h H. Peter Anvin 2012-02-19  12  
b11caa7c include/asm-x86/unistd.h      Adrian Bunk    2008-04-20  13  # ifdef CONFIG_X86_32
303395ac arch/x86/include/asm/unistd.h H. Peter Anvin 2011-11-11  14  
303395ac arch/x86/include/asm/unistd.h H. Peter Anvin 2011-11-11 @15  #  include <asm/unistd_32.h>
303395ac arch/x86/include/asm/unistd.h H. Peter Anvin 2011-11-11  16  #  define __ARCH_WANT_STAT64
4f2f81a5 arch/x86/include/asm/unistd.h H. Peter Anvin 2012-01-19  17  #  define __ARCH_WANT_SYS_IPC
303395ac arch/x86/include/asm/unistd.h H. Peter Anvin 2011-11-11  18  #  define __ARCH_WANT_SYS_OLD_MMAP
303395ac arch/x86/include/asm/unistd.h H. Peter Anvin 2011-11-11  19  #  define __ARCH_WANT_SYS_OLD_SELECT
303395ac arch/x86/include/asm/unistd.h H. Peter Anvin 2011-11-11  20  
b11caa7c include/asm-x86/unistd.h      Adrian Bunk    2008-04-20  21  # else
303395ac arch/x86/include/asm/unistd.h H. Peter Anvin 2011-11-11  22  
303395ac arch/x86/include/asm/unistd.h H. Peter Anvin 2011-11-11  23  #  include <asm/unistd_64.h>

:::::: The code at line 15 was first introduced by commit
:::::: 303395ac3bf3e2cb488435537d416bc840438fcb x86: Generate system call tables and unistd_*.h from tables

:::::: TO: H. Peter Anvin <hpa@linux.intel.com>
:::::: CC: H. Peter Anvin <hpa@linux.intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Jan. 19, 2016, 11:20 a.m. UTC | #3
Hi James,

[auto build test ERROR on kbuild/for-next]
[also build test ERROR on v4.4 next-20160119]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/James-Hogan/kbuild-Remove-stale-asm-generic-wrappers/20160119-183642
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git for-next
config: x86_64-randconfig-s3-01191831 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from arch/x86/kernel/asm-offsets.c:27:0:
>> arch/x86/kernel/asm-offsets_64.c:15:29: fatal error: asm/syscalls_64.h: No such file or directory
   compilation terminated.
   make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +15 arch/x86/kernel/asm-offsets_64.c

5de2b61a arch/x86/kernel/asm-offsets_64.c    Borislav Petkov   2014-12-09   1  #ifndef __LINUX_KBUILD_H
5de2b61a arch/x86/kernel/asm-offsets_64.c    Borislav Petkov   2014-12-09   2  # error "Please do not build this file directly, build asm-offsets.c instead"
5de2b61a arch/x86/kernel/asm-offsets_64.c    Borislav Petkov   2014-12-09   3  #endif
5de2b61a arch/x86/kernel/asm-offsets_64.c    Borislav Petkov   2014-12-09   4  
c3ca5f30 arch/x86_64/kernel/asm-offsets_64.c Thomas Gleixner   2007-10-11   5  #include <asm/ia32.h>
8869a2e5 arch/x86/kernel/asm-offsets_64.c    Hiroshi Shimamoto 2008-12-18   6  
303395ac arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2011-11-11   7  #define __SYSCALL_64(nr, sym, compat) [nr] = 1,
6630f11b arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2012-02-14   8  #define __SYSCALL_COMMON(nr, sym, compat) [nr] = 1,
a06c9bc0 arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2012-02-19   9  #ifdef CONFIG_X86_X32_ABI
a06c9bc0 arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2012-02-19  10  # define __SYSCALL_X32(nr, sym, compat) [nr] = 1,
a06c9bc0 arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2012-02-19  11  #else
a06c9bc0 arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2012-02-19  12  # define __SYSCALL_X32(nr, sym, compat) /* nothing */
a06c9bc0 arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2012-02-19  13  #endif
303395ac arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2011-11-11  14  static char syscalls_64[] = {
303395ac arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2011-11-11 @15  #include <asm/syscalls_64.h>
303395ac arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2011-11-11  16  };
303395ac arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2011-11-11  17  #define __SYSCALL_I386(nr, sym, compat) [nr] = 1,
303395ac arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2011-11-11  18  static char syscalls_ia32[] = {
303395ac arch/x86/kernel/asm-offsets_64.c    H. Peter Anvin    2011-11-11  19  #include <asm/syscalls_32.h>
c3ca5f30 arch/x86_64/kernel/asm-offsets_64.c Thomas Gleixner   2007-10-11  20  };
c3ca5f30 arch/x86_64/kernel/asm-offsets_64.c Thomas Gleixner   2007-10-11  21  
c3ca5f30 arch/x86_64/kernel/asm-offsets_64.c Thomas Gleixner   2007-10-11  22  int main(void)
c3ca5f30 arch/x86_64/kernel/asm-offsets_64.c Thomas Gleixner   2007-10-11  23  {

:::::: The code at line 15 was first introduced by commit
:::::: 303395ac3bf3e2cb488435537d416bc840438fcb x86: Generate system call tables and unistd_*.h from tables

:::::: TO: H. Peter Anvin <hpa@linux.intel.com>
:::::: CC: H. Peter Anvin <hpa@linux.intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic
index 045e0098e962..7422f6476a8a 100644
--- a/scripts/Makefile.asm-generic
+++ b/scripts/Makefile.asm-generic
@@ -21,3 +21,19 @@  all: $(patsubst %, $(obj)/%, $(generic-y))
 
 $(obj)/%.h:
 	$(call cmd,wrap)
+
+# Remove stale wrappers when the corresponding files are removed from
+# generic-y
+
+quiet_cmd_rmwrap = REMOVE  $(patsubst %.rm,%,$@)
+cmd_rmwrap = rm -f $(patsubst %.rm, %, $@)
+
+all: $(filter-out $(patsubst %, $(obj)/%.rm, $(generic-y)), \
+                  $(patsubst %, %.rm, $(wildcard $(obj)/*.h)))
+
+$(obj)/%.h.rm: FORCE
+	$(call cmd,rmwrap)
+
+.PHONY: $(PHONY)
+PHONY += FORCE
+FORCE: ;