Patch 050_virtualbox-5.1.4-nopie.patch from virtualbox-5.1.18-patches-01.tar.xz archive failed with "1 out of 12 hunks FAILED -- saving rejects to file Config.kmk.rej" message. With changes in virtualbox-5.1.20, patch 7th chunk is now redundant and must be removed.
Is this ebuild coming from ::gentoo repository or some overlay?
No overlay, I too get this error in ::gentoo.
Created attachment 471138 [details, diff] Updated nopie patch for virtualbox-5.1.20. This is an updated patch for 5.1.20. It builds fine on amd64. Unfortunately, VMs crash on startup. This is probably due to bug #616240 but could also be related to this patch.
*** Bug 617858 has been marked as a duplicate of this bug. ***
Created attachment 472618 [details, diff] Updated nopie patch for 5.1.22-r1 This patch worked for me to compile virtualbox-5.1.22-r1 on hardened kernel 4.9.24 and gcc-5.4.0-r3.
Archive in https://dev.gentoo.org/~polynomial-c/virtualbox/patchsets/ is still not updated for 5.1.22 with this new patch! :-(
virtualbox-5.1.x is no longer in the tree. If this is still an issue, please file a new bug.