Merge patches from toolchain-2.6 branch?

These two commits have never been merged to toolchain-2.7 or master...