https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108328
--- Comment #6 from Sagi Mor <sagimor6 at gmail dot com> --- Well, this is only for aarch64 and arc, and they do compile the kernel in buildroot, so it seems to work? (never checked myself) By the way, they solve the -Wl,z,relro for kernel/uboot compilation by checking if -D__KERNEL__ or -D__UBOOT__ was specified and then not adding the link flag, which is an eye-opener for me.