On Jan 6, 5:46pm, rokuy...@rk.phys.keio.ac.jp (Rin Okuyama) wrote: -- Subject: Unaligned access in kernel on ARMv6+ (Re: CVS commit: src/sys/dev
| I guess other codes can be miscompiled if -mno-unaligned-access is | not specified. Can I commit the patch? I believe this is the right way to do it, since we don't want unaligned accesses in the kernel. Best, christos | | Thanks, | rin | ---- | Index: sys/arch/arm/conf/Makefile.arm | =================================================================== | RCS file: /home/netbsd/src/sys/arch/arm/conf/Makefile.arm,v | retrieving revision 1.49 | diff -p -u -r1.49 Makefile.arm | --- sys/arch/arm/conf/Makefile.arm 22 Sep 2018 12:24:01 -0000 1.49 | +++ sys/arch/arm/conf/Makefile.arm 6 Jan 2019 08:14:56 -0000 | @@ -53,6 +53,13 @@ CPPFLAGS.cpufunc_asm_armv6.S+= -mcpu=arm | CPPFLAGS.cpufunc_asm_arm11.S+= -mcpu=arm1136j-s | CPPFLAGS.cpufunc_asm_xscale.S+= -mcpu=xscale | | +# For GCC, -munaligned-access is enabled by default for ARMv6+. | +# But the unaligned access is forbidden in the supervisor mode. | +.if (!empty(MACHINE_ARCH:Mearmv6*) || !empty(MACHINE_ARCH:Mearmv7*)) \ | + && ${ACTIVE_CC} == "gcc" | +CFLAGS+= -mno-unaligned-access | +.endif | + | ## | ## (3) libkern and compat | ## -- End of excerpt from Rin Okuyama