Our dynamic linker depends on this feature, so it would be nice to have.
Details
- Reviewers
ruiu • rafael - Commits
- rG97403d15eece: Eliminate LayoutInputSection class
rGaa49819162d6: Add DT_REL(A)COUNT tag to .dynamic section
rLLD280348: Eliminate LayoutInputSection class
rLLD280210: Add DT_REL(A)COUNT tag to .dynamic section
rL280348: Eliminate LayoutInputSection class
rL280210: Add DT_REL(A)COUNT tag to .dynamic section
Diff Detail
Event Timeline
ELF/OutputSections.cpp | ||
---|---|---|
366 | This breaks the optimization implemented in D19528 I think. bool ARel = A.Type == Target->RelativeRel; bool BRel = B.Type == Target->RelativeRel; if (ARel && !BRel) return true; else if (!ARel && BRel) return false; return A.getSymbol(Config->Mips64EL) < B.getSymbol(Config->Mips64EL); | |
test/ELF/aarch64-tls-gdie.s | ||
27 ↗ | (On Diff #68529) | 0x0B0 != 192 |
test/ELF/aarch64-tls-ie.s | ||
34 ↗ | (On Diff #68529) | Ditto. |
test/ELF/combrelocs.s | ||
43 ↗ | (On Diff #68529) | You probably want to check that RELACOUNT is present instead of removing it. |
test/ELF/gotpc-relax-nopic.s | ||
19 | Excessive new lines. |
Sorry, I missed the comments, because notifications are not working for me today for some reason.
Review updated.
Diff updated
a) Fix bug in calculating number of relative relocs
b) When number of relative relocs is zero DT_REL(A)COUNT is not emitted. This greatly decreased number of patched unit tests
c) For all modified tests, I've added addition check that DET_REL(A)COUNT matches actual number of relative relocs
ELF/OutputSections.cpp | ||
---|---|---|
672–674 | I'm not sure if it is the right thing to not emit DT_REL[A]COUNT if there are no relative relocations. If the number of relative relocations is zero, shouldn't we write zero? |
ELF/OutputSections.cpp | ||
---|---|---|
672–674 | This doc: Says that DT_RELACOUNT is an optional field. Our dynamic linker assumes that number of relative relocs is zero, unless there is a DT_REL(A)COUNT tag. That said, I don't see any reason for writing it always. |
LGTM. If an absence of DT_RELCOUNT doesn't cause any trouble, this is fine by me. By the way, by "our dynamic loader", did you mean a dynamic loader of your operating system or something? Just curious.
This breaks the optimization implemented in D19528 I think.
We found that sorting by symbol makes sence. So that should be done even for
relative relocations. I would suggest something like: