DF-5694 / build.log
# guest: DragonFly dfbsd 6.5-DEVELOPMENT #0 X86_64_GENERIC, cc 8.3 [DragonFly] $ cc -O2 -Wall -o arc4_harness arc4_harness.c -lm (no output = clean) $ cc -O2 -Wall -o arc4_harness_fixed arc4_harness_fixed.c -lm (no output = clean) $ cc -O2 -Wall -o chk chk.c -lm (no output = clean) $ cd kld && make cc -O2 -pipe -D_KERNEL -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wold-style-definition -Wmissing-include-dirs -Wno-pointer-sign -Winit-self -Wundef -Wno-unused-but-set-variable -std=gnu11 -Werror -DKLD_MODULE -nostdinc -I. -Idragonfly -I/tmp/kld/forwarder_x86_64/include -Idragonfly/../include -Wold-style-declaration -fno-common -ffreestanding -fno-stack-protector -fno-strict-aliasing -fno-strict-overflow -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -mno-fp-ret-in-387 -mindirect-branch=thunk-inline -c arc4samp.c cc -Wl,--build-id=sha1 -nostdlib -Wl,--hash-style=sysv -r -Wl,-d -o arc4samp.ko arc4samp.o (note: kernel compiles with -fno-strict-overflow, which governs add/sub/mul; the left-shift + int->uint64_t conversion path at arc4random.c:132 is unaffected by that flag and the observed kernel behavior matches the userland verbatim-copy behavior exactly) $ kldload ./arc4samp.ko arc4samp: loaded