xray_instr_map contains absolute addresses of sleds, which are relocated
by R_*_RELATIVE when linked in -pie or -shared mode.
By making these addresses relative to PC, we can avoid the dynamic
relocations and remove the SHF_WRITE flag from xray_instr_map. We can
thus save VM pages containg xray_instr_map (because they are not
modified).
This patch changes x86-64. Subsequent changes will change powerpc64le
and AArch64.
How do you handle backwards-compatibility here? i.e. what happens when you link in a new compiler-rt implementation with a previous-versioned XRay instrumented .o file?
My suspicion is you'll need to increment the version to determine whether you're using pc-relative addressing or whether it's the old style absolute addressing. Otherwise there'd be potential for random memory addresses and potential corruption going on.