eugenis added a comment. Thank you, this looks and works great! My earlier comment still needs to be addressed though, casts to InputSection must be replaced with dyn_cast<> with null checks. https://reviews.llvm.org/D28626