[PATCH] D66007: [ELF] Move (copy relocation/canonical PLT) before error checking

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 04:54:33 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: grimar, peter.smith, ruiu.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

In processRelocAux(), we handle errors before copy relocation/canonical PLT.
This makes error checking a bit complex because we have to check for
conditions that will be allowed by copy relocation/canonical PLT.

Instead, move copy relocation/canonical PLT before error checking. This
simplifies the previous clumsy error checking code

`config->shared || (config->pie && expr == R_ABS && type != target->symbolicRel)`

to the simple `config->isPic`. Some diagnostics can be reported in
different ways. The code motion changes diagnostics for some contrived
test cases:

- copy-rel-pie-error.s -> copy-rel-pie2.s: It was rejected before but accepted now. ld.bfd also accepts the case.
- copy-errors.s: "cannot preempt symbol" changes to "symbol 'bar' has no type"
- typed-undef.s: A previous `errorOrWarn` clause changes to `error` clause so --unresolved-symbols=ignore-all does not suppress the error.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D66007

Files:
  ELF/Relocations.cpp
  test/ELF/copy-errors.s
  test/ELF/copy-rel-pie-error.s
  test/ELF/copy-rel-pie2.s
  test/ELF/typed-undef.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66007.214356.patch
Type: text/x-patch
Size: 7569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190809/771600fa/attachment.bin>


More information about the llvm-commits mailing list