ruiu added a comment. I don't think it is a good idea to remove debug sections using the garbage collector. That is unnecessarily complicated. You should simply remove debug sections from InputSections before markLive(). https://reviews.llvm.org/D39550