Code and test are largely identical to the LLD-ELF equivalents. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D99312