The patch does not reduce the size of the code but makes InputSectionBase::relocate cleaner a bit.
Details
- Reviewers
ruiu • rafael grimar - Commits
- rG604aee134adb: [ELF][MIPS] Factor out SumVA adjustments into a couple of separate functions.
rLLD263381: [ELF][MIPS] Factor out SumVA adjustments into a couple of separate functions.
rL263381: [ELF][MIPS] Factor out SumVA adjustments into a couple of separate functions.
Diff Detail
- Repository
- rL LLVM
Event Timeline
Generally this looks good to me, have few notes though.
ELF/InputSection.cpp | ||
---|---|---|
219 ↗ | (On Diff #50524) | Is that correct ? Originally addend was added: SymVA = Out<ELFT>::Got->getMipsLocalFullAddr(Body) + A; } } else { SymVA = Body.getGotVA<ELFT>() + A; |
290 ↗ | (On Diff #50524) | I don't like this place because it has "if (Config->EMachine == EM_MIPS)"
and do: template <class ELFT, class uintX_t> static uintX_t getGotVA(const SymbolBody &Body, uintX_t A, uint8_t *BufLoc, uint8_t *PairedLoc) { if (Config->EMachine != EM_MIPS) return Body.getGotVA<ELFT>() + A; ... else if (Target->needsGot(Type, Body)) { SymVA = getGotVA<ELFT>(Body, A, BufLoc, PairedLoc); ... |
Since this is a refactoring patch to split the function, LGTM.
But I really want you and all other people who are working on MIPS to not only add code to the support current MIPS ABI but also make efforts to fix the ABI. Some parts of the ABI are very odd and sometimes even broken (e.g. the mixed endian header field), and supporting it sometimes really complicates stuff (like the paired relocations.)
ELF/InputSection.cpp | ||
---|---|---|
290 ↗ | (On Diff #50524) | I prefer the other way. This function would not have been written if MIPS ABI were not so weird. I want to keep the code in the form that you can ignore all function calls including "mips" if you are not interested in MIPS. If you move that code into the function, you have to jump to that function and read that function only to know that that was basically separated for MIPS oddity. |
Thanks for review.
The oddity of MIPS ABI is obvious to everybody. Probably the ABI will be changed gradually or by release completely new ABI but anyway it is a long process.
ELF/InputSection.cpp | ||
---|---|---|
219 ↗ | (On Diff #50524) | It is correct for 32-bit MIPS because in that case we use REL format and have to extract addend from the buffer insider the relocateOne routine. The A is always zero. But I will return + A expressions before commit the patch to escape unnecessary changes. |