[PATCH] D38724: [ELF] - Do not collect SHT_REL[A] sections unconditionally when --gc-sections and --emit-relocs used together.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 16 10:50:48 PDT 2017


ruiu added a comment.

I'm not convinced. It may fail on some assert, or it may not work well with the current code, but my comment was from a more high-level design point of view. I'd like you to also think at high-level instead of tracing the existing code to explain why your patch needs to be in the current design.

You are writing a mark-sweep garbage collector. In the mark phase, you mark all root objects as alive, and mark all reachable objects as alive. In this phase, the knowledge of whether some object is a gc root or not is needed only at the beginning of the algorithm. If not, it is probably a sign that something is not correct. If that's the case, we need to find a design flaw and fix it, instead of writing more code on top of a wrong assumption.

Did you take a look why we had the assert? Can you explain why the assertion is there? I wonder if it makes sense.


https://reviews.llvm.org/D38724





More information about the llvm-commits mailing list