[PATCH] D48247: lld: add experimental support for SHT_RELR sections.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 26 17:19:51 PDT 2018


pcc added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:1747
+    if (Current%2 != 0) {
+      error("odd offset for RELR relocation (" + Twine(Current) + "), " +
+            "pass --pack-dyn-relocs=none to disable RELR relocations");
----------------
rahulchaudhry wrote:
> pcc wrote:
> > I think you can avoid needing to error on this by only creating RELR relocations for relocations at even offsets in sections with sh_addralign >= 2. In practice I think this would be almost every section that might contain a relative relocation.
> I guess the check would now be in Relocations.cpp before calling InX::RelrDyn->addReloc().
> Any hint on what the check would be? I don't see any other obvious place in that file checking for section alignment.
> I think this check should still be preserved, just in case something odd ends up here (maybe convert it to fatal?)
> 
> I think this check should still be preserved, just in case something odd ends up here (maybe convert it to fatal?)

We shouldn't expect this to happen because of the guarantees provided by the rest of the program, so you can make it an assert.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D48247





More information about the llvm-commits mailing list