This patch introduces the next changes:
- During Writer<ELFT>::scanRelocs() marks and remembers for each relocation if it can be optimized(relaxed) or not.
- In following code remembered values are used. (RelocationSection<ELFT>::writeTo() is not covered yet, it is possible to make it use remembered values also, If this patch will be ok, I`ll do that).
- InputSectionBase<ELFT>::relocate() is split to relocateNotOptimized and relocateOptimized. So relaxations are handled separately what also simplified the code.
All above allowed to significantly reduce amount excessive isTlsOptimized calls (after fixing p2 which has one, the only places will be in Target class, what is fine and expected I believe).
I introduced
struct RelocData { bool Optimized = false; };
struct for each relocation data, but It looks single boolean is enough now and I can replace the struct with single bool. Not sure will we need to remember any other data for relocations ?
Why do you need a struct that has only one member?