[PATCH] D47602: Correct aligment computation for shared object symbols

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 5 11:25:51 PDT 2018


pcc added inline comments.


================
Comment at: ELF/Relocations.cpp:532-534
+  if (SS.Alignment == 0)
+    fatal("cannot create a copy relocation for symbol "
+          "with absolute address " + toString(SS));
----------------
ruiu wrote:
> shenhan wrote:
> > ruiu wrote:
> > > Can you really trigger this? Please always add a test when you add a new feature.
> > No, from the discussion, this could never be triggered, otherwise this is a linker error.
> > Replaced with assert.
> We don't add use assert() that much in lld. Please just remove.
It's possible to get here with something like (the somewhat contrived)
```
.globl abs
abs = 0
.size abs, 1
```
in a .so, I think. I was imagining that we'd change the `if (SymSize == 0)` above to be `if (SymSize == 0 || SS.Alignment == 0)`. That would cover this case as well as the huge alignment case.


https://reviews.llvm.org/D47602





More information about the llvm-commits mailing list