As for now, llvm-objcopy renames only sections that are specified explicitly in --rename-section, while GNU objcopy keeps names of relocation sections in sync with their targets. For example:
> readelf -S test.o ... [ 1] .foo PROGBITS [ 2] .rela.foo RELA > objcopy --rename-section .foo=.bar test.o gnu.o > readelf -S gnu.o ... [ 1] .bar PROGBITS [ 2] .rela.bar RELA > llvm-objcopy --rename-section .foo=.bar test.o llvm.o > readelf -S llvm.o ... [ 1] .bar PROGBITS [ 2] .rela.foo RELA
This patch makes llvm-objcopy to match the behavior of GNU objcopy better.
The two tests can be combined.
One file with different cases is sometimes easier to comprehend than having multiple files.
Is there a test renaming non-SHF_ALLOC relocation section?