3.12: update to latest mainline, resolve merge conflicts

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>