The idea is to make scanRelocations just some actions are needed (GOT/PLT/etc)
and postpone the real work to postScanRelocations. It gives some flexibility:
- Make it feasible to support .plt.got (PR32938): we need to know whether GLOB_DAT and JUMP_SLOT are both needed.
- Make non-preemptible IFUNC handling slightly cleaner: avoid setting/clearing sym.gotInIgot
- -z nocopyrel: report all copy relocation places for one symbol
- Make parallel relocation scanning possible (if we can avoid all stateful operations and make Symbol attributes atomic), but parallelism may not be the appealing choice
- Make GOT deduplication feasible
Since this patch moves a large chunk of code out of ELFT templates. My x86-64
executable is actually a few hundred bytes smaller.
For ppc32-ifunc-nonpreemptible-pic.s: I remove absolute relocation references to non-preemptible ifunc
because absolute relocation references are incorrect in -fpie mode.
As we know that a PLT entry is needed, we can set the flag and simplify postScanRelocations() a bit.