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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 05:59:56 PDT 2019


MaskRay abandoned this revision.
MaskRay added a comment.

In D67754#1675049 <https://reviews.llvm.org/D67754#1675049>, @grimar wrote:

> Two questions:
>
> 1. Why it is not a error? As far I understood after reading comments for PR, this is what bfd would do? (https://bugs.llvm.org/show_bug.cgi?id=43147#c8)


I agree an error is the way to go. I had started to work on this patch before I read Peter's comment...

> 2. Should we instead disable GC for that case maybe?

Yes. I highly suspect the sanitizer has a bug. Whether or not it is a real bug, @manojgupta	has to use --no-gc-sections.

> 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.

I thought ld.bfd would accept such cases. It accepts section-metadata.s in this patch but rejects https://bugs.llvm.org/show_bug.cgi?id=43147#c8
After some experiments, I believe it just checks the linked-to section of the first input section. Given the intention of the error, I think it is likely a oversight that it is more permissive. I'll file a bug on its Bugzilla.

Abandoned. We should go with D67761 <https://reviews.llvm.org/D67761>.


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