main/musl: cherry-pick fixes and compatibility improvements from upstream