[PATCH] D67754: [ELF] Fix two null pointer dereferences related to SHF_LINK_ORDER with --gc-sections

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 05:12:33 PDT 2019


peter.smith added a comment.

This will definitely avoid a crash but I'm not sure if a program that can trigger the crash is well defined under garbage collection. For a section A with link order dependency on section B, with A live and B not live, there is a requirement to order section B with respect to the address of section A, and we can't know what the address is if B has been garbage collected. Making an arbitrary choice for the address will work for cases where removing B means that the order of A doesn't matter, however if the order of A does matter then we could get a run-time error.

I personally favour an error message, but I suppose a warning that the linker has made an arbitrary choice, or disabled garbage collection, could also work.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D67754





More information about the llvm-commits mailing list