dolohow / uksm

Ultra Kernel Samepage Merging
242 stars 35 forks source link

Lots of warnings when kernel is build with LLVM/clang #53

Open tpgxyz opened 4 years ago

tpgxyz commented 4 years ago

At OpenMandriva we uses LLVM/clang as default compiler. We managed to build kernel with LLVM/clang. Unfortunately i've noticed that UKSM patch produces lots of warnings. Full logs can be found here https://abf.openmandriva.org/build_lists/646308

  CC      mm/memory.o
BUILDSTDERR: In file included from mm/memory.c:54:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from mm/memory.c:54:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      kernel/events/callchain.o
  CC      arch/x86/kernel/cpu/umwait.o
  CC [M]  arch/x86/kvm/vmx/vmx.o
  CC      mm/mmap.o
BUILDSTDERR: In file included from mm/mmap.c:49:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from mm/mmap.c:49:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      mm/mprotect.o
BUILDSTDERR: In file included from mm/mprotect.c:28:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from mm/mprotect.c:28:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      mm/mremap.o
BUILDSTDERR: In file included from mm/mremap.c:14:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from mm/mremap.c:14:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      mm/rmap.o
BUILDSTDERR: In file included from mm/rmap.c:56:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from mm/rmap.c:56:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      mm/madvise.o
BUILDSTDERR: In file included from mm/madvise.c:19:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from mm/madvise.c:19:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      mm/swapfile.o
BUILDSTDERR: In file included from mm/swapfile.c:27:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from mm/swapfile.c:27:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated
  CC      mm/mempolicy.o
BUILDSTDERR: In file included from mm/mempolicy.c:93:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from mm/mempolicy.c:93:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      mm/uksm.o
BUILDSTDERR: In file included from mm/uksm.c:66:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from mm/uksm.c:66:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      kernel/fork.o
BUILDSTDERR: In file included from kernel/fork.c:70:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from kernel/fork.c:70:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      mm/migrate.o
BUILDSTDERR: In file included from mm/migrate.c:25:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from mm/migrate.c:25:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      mm/memory-failure.o
BUILDSTDERR: In file included from mm/memory-failure.c:42:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from mm/memory-failure.c:42:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      fs/proc/page.o
BUILDSTDERR: In file included from fs/proc/page.c:6:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from fs/proc/page.c:6:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated.
  CC      fs/exec.o
BUILDSTDERR: In file included from fs/exec.c:66:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:884:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: In file included from fs/exec.c:66:
BUILDSTDERR: In file included from ./include/linux/ksm.h:122:
BUILDSTDERR: ./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
BUILDSTDERR: extern unsigned long uksm_zero_pfn __read_mostly;
BUILDSTDERR:                      ^
BUILDSTDERR: ./include/asm-generic/pgtable.h:861:23: note: previous declaration is here
BUILDSTDERR:         extern unsigned long uksm_zero_pfn;
BUILDSTDERR:                              ^
BUILDSTDERR: 2 warnings generated
dolohow commented 2 years ago

Addressed in https://github.com/dolohow/uksm/pull/71 https://github.com/dolohow/uksm/commit/d287282e37b60192ee39f536d284f8abfa70eb40