This is PR31579.
-q, --emit-relocs - Generate relocations in output
We used DynsymIndex for storing symtab index of symbol for -r
and I reused it in this patch for the same for --emit-relocs.
Had to add restriction that --emit-reloc and -pie/-shared/.so inputs
are not compatible together (so .dynsym is never created with --emit-reloc).
That seems fine as looks enough to fix PR31579.
Alternative probably can be another variable in SymbolBody for that,
but I am not sure we want it.