The bits to be relocated should already contain all zeros, no need to and the call instructions with the inverse mask before relocating.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lld/ELF/Arch/PPC64.cpp | ||
---|---|---|
976 | This existing code have one fewer assumption. What's the motivation behind the change? |
lld/ELF/Arch/PPC64.cpp | ||
---|---|---|
976 | The motivation is consistency: We don't zero out the bits before writing them in the handling of any of the other relocations, we assume the bits to be relocated already contain zeros. |
Shall we mask out the bits (keep existing (read32(loc) & ~mask))? If other relocations don't behave this way, let's fix it. Writing zeros to the bits is a courtesy of the assembly but should we make use of the assumption? PPC64 is a RELA target and for an RELA target the implicit addend should be relied upon. AArch64.cpp masks out the bits as well.
My concern was how the linker being nice lead to a misunderstanding of how to encode an instruction. I've left a more detailed comment in the PCREL34 review so we can keep the discussion there and I can either abandon this or commit it depending on which way the discussion goes.
This existing code have one fewer assumption. What's the motivation behind the change?