apple-gcc42: backport changes from core