[PATCH] D72904: [ELF] Allow SHF_LINK_ORDER sections to have sh_link=0

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 18 13:58:49 PDT 2020


psmith added a comment.

In D72904#2157639 <https://reviews.llvm.org/D72904#2157639>, @jhenderson wrote:

> Whilst the actual change seems fine, in that it does what it sets out to do, I believe, I'm struggling to follow why a SHF_LINK_ORDER section should have a sh_link of 0 at all. Surely the section should just then not have SHF_LINK_ORDER? What sections actually have sh_link=0 and SHF_LINK_ORDER?


>From memory there was an unfortunate interaction with Garbage Collection that ended up with sh_link being 0. I think in the PR there was something like:

- non-live-section <- metadata1 (SHF_LINK_ORDER) to non-live-section
- live-section -> metadata1

The non-live-section was removed but due to another live-section referencing the metadata was kept.

I'm not particularly keen on use of SHF_LINK_ORDER just for garbage collection, but I don't think that view is the majority so on balance being robust to this situation is definitely better than a crash/assertion failure.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72904/new/

https://reviews.llvm.org/D72904





More information about the llvm-commits mailing list