Integrate some patches from devel/libffi.