Do not merge sections if generate a relocatable object. It makes the code simpler because we do not need to update relocations addend to reflect changes introduced by merging. Instead of that we write such "merge" sections into separate output ones and keep SHF_MERGE / SHF_STRINGS flags and sh_entsize value to be able to perform merging later during a final linking.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
ELF/InputFiles.cpp | ||
---|---|---|
181–184 ↗ | (On Diff #72973) | The thing that a relocation could point to a location beyond the end of a section is a bug if we don't update a relocation, and that is fixable. So I found this explanation a bit confusing. It is just that we don't merge strings as a design decision because (1) it makes code simpler and (2) the final link will merge strings anyway so we don't lose almost nothing by not doing this at the moment. Could you clarify these points? |
Comment Actions
- Update comment
- Keep sh_entsize values of "merge" sections to allow merging at final linking
Comment Actions
I think the implementation looks ok. I have made some suggestions to improve the comment, but I understood what it meant as it was written.
ELF/InputFiles.cpp | ||
---|---|---|
179 ↗ | (On Diff #73425) | A few suggestions for the comment. |