dolohow / uksm

Ultra Kernel Samepage Merging
242 stars 35 forks source link

clang does not compile on aarch64 #69

Open tpgxyz opened 3 years ago

tpgxyz commented 3 years ago

kernel 5.12.7 does not want to compile with UKSM patch on aarch64.

  clang -Wp,-MMD,mm/.uksm.o.d -nostdinc -isystem /usr/lib64/clang/12.0.0/include -I./arch/arm64/include -I./arch/arm64/include/generated  -I./include -I./arch/arm64/include/uapi -I./arch/arm64/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -mlittle-endian -DKASAN_SHADOW_SCALE_SHIFT= -Qunused-arguments -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -Werror=unknown-warning-option -mgeneral-regs-only -DCONFIG_CC_HAS_K_CONSTRAINT=1 -Wno-psabi -fno-asynchronous-unwind-tables -fno-unwind-tables -mbranch-protection=pac-ret+leaf+bti -Wa,-march=armv8.5-a -DARM64_ASM_ARCH='"armv8.5-a"' -DKASAN_SHADOW_SCALE_SHIFT= -fno-delete-null-pointer-checks -Wno-frame-address -Wno-address-of-packed-member -O2 -Wframe-larger-than=1024 -fstack-protector-strong -Wno-format-invalid-specifier -Wno-gnu -mno-global-merge -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-lto -flto -fvisibility=hidden -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -fno-strict-overflow -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -Wno-initializer-overrides -Wno-format -Wno-sign-compare -Wno-format-zero-length -Wno-pointer-to-enum-cast -Wno-tautological-constant-out-of-range-compare    -DKBUILD_MODFILE='"mm/uksm"' -DKBUILD_BASENAME='"uksm"' -DKBUILD_MODNAME='"uksm"' -D__KBUILD_MODNAME=kmod_uksm -c -o mm/uksm.o mm/uksm.c
In file included from mm/uksm.c:66:
In file included from ./include/linux/ksm.h:115:
./include/linux/uksm.h:19:22: warning: section attribute is specified on redeclared variable [-Wsection]
extern unsigned long zero_pfn __read_mostly;
                     ^
./include/linux/pgtable.h:1140:23: note: previous declaration is here
        extern unsigned long zero_pfn;
                             ^
In file included from mm/uksm.c:66:
In file included from ./include/linux/ksm.h:115:
./include/linux/uksm.h:20:22: warning: section attribute is specified on redeclared variable [-Wsection]
extern unsigned long uksm_zero_pfn __read_mostly;
                     ^
./include/linux/pgtable.h:1117:23: note: previous declaration is here
        extern unsigned long uksm_zero_pfn;
                             ^
mm/uksm.c:174:17: error: initializing 'unsigned long *' with an expression of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
        unsigned long *src = s1;
                       ^     ~~
2 warnings and 1 error generated.
make[1]: *** [scripts/Makefile.build:271: mm/uksm.o] Error 1
make: *** [Makefile:1854: mm] Error 2
make: *** Waiting for unfinished jobs....
dolohow commented 3 years ago

Does it compile with 5.12.0?

tpgxyz commented 3 years ago

@dolohow Yes of course it compiles on x86_64, but does not on aarch64.

dolohow commented 3 years ago

Did you try with gcc?

tpgxyz commented 3 years ago

Yes it does bulild with gcc on aarch64 with UKSM patch.

dolohow commented 3 years ago

I will look into this tomorrow, probably.

dolohow commented 3 years ago

Can you try with the latest version?

tpgxyz commented 3 years ago

Yes it does wotk with LLVM/clang and aarch64

Manouchehri commented 2 years ago

Any reason this was reopened?