Backport upstream fixes for latest Clang.

This is required to compile on recent OS Xen.