I'm trying to compile zfsonlinux (https://github.com/zfsonlinux) with gentoo hardened kernel and compilation fails: CC [M] /home/user/soft/spl/module/spl/../../module/spl/spl-module.o /home/user/soft/spl/module/spl/../../module/spl/spl-module.c: In function ‘__ddi_create_minor_node’: /home/user/soft/spl/module/spl/../../module/spl/spl-module.c:124:2: error: assignment of read-only location ‘*fops’ /home/user/soft/spl/module/spl/../../module/spl/spl-module.c:126:3: error: assignment of read-only location ‘*fops’ /home/user/soft/spl/module/spl/../../module/spl/spl-module.c:128:3: error: assignment of read-only location ‘*fops’ make[5]: *** [/home/user/soft/spl/module/spl/../../module/spl/spl-module.o] Error 1 make[4]: *** [/home/user/soft/spl/module/spl] Error 2 make[3]: *** [_module_/home/user/soft/spl/module] Error 2 Cut of failed code from spl-module.c: 92 int 93 __ddi_create_minor_node(dev_info_t *di, char *name, int spec_type, 94 minor_t minor_num, char *node_type, 95 int flags, struct module *mod) 96 { 97 struct cdev *cdev; 98 struct cb_ops *cb_ops; 99 struct file_operations *fops; 100 int rc; 101 SENTRY; ... 123 /* Setup the fops to cb_ops mapping */ 124 fops->owner = mod; 125 if (cb_ops->cb_ioctl) { 126 fops->unlocked_ioctl = mod_generic_unlocked_ioctl; 127 #ifdef CONFIG_COMPAT 128 fops->compat_ioctl = mod_generic_compat_ioctl; 129 #endif 130 } My investigation (as my abilities allowed) showed that problem rises in hardened kernel, because it adds some attribute named do_const to structure file_operations. Which seems is plugin to gcc, which makes it const by default. Is this a bug or feature. And if second, then how can I workaround it?