When --compress-debug-sections is given,
llvm-objcopy removes the uncompressed sections and adds compressed to the section list.
This makes all the pointers to old sections to be outdated.
Currently, code already has logic for replacing the target sections of the relocation
sections. But we also have to update the relocations by themselves.
This fixes https://bugs.llvm.org/show_bug.cgi?id=40885.
I thought about adding one more section .debug_bar and do something like:
i.e. to show that if relocation section .rela.X has target X and relocation that references Y,
where X and Y are replaced debug section then we handle it correctly.
But I am not sure it worth doing that actually since the existent test covers the all code
added I think. I.e. it tests that if relocation section .rela.X has target X and relocation that references X,
where X is a replaced debug section then we handle it correctly.
Since both the code pieces that fixes section target and relocations themselves are different and both used,
maybe it is already enough here.