For a relocation, we don't differentiate the two cases:
- the symbol index is 0
- the symbol index is non zero, the type is not STT_SECTION, and the name is empty. Clang generates such local symbols for RISC-V linker relaxation.
So we may print
Offset Info Type Symbol's Value Symbol's Name + Addend 000000000000001c 0000000100000039 R_RISCV_32_PCREL 0000000000000000 0 // llvm-readobj 0x1C R_RISCV_32_PCREL - 0x0
while GNU readelf prints "<null>", which is clearer. Let's match the GNU behavior.
Related to https://reviews.llvm.org/D81842
000000000000001c 0000000100000039 R_RISCV_32_PCREL 0000000000000000 <null> + 0 // llvm-readobj 0x1C R_RISCV_32_PCREL <null> 0x0
If I'm not mistaken, we don't actually have a dedicated test case for this bit of the logic? (It's covered by other tests, but more by accident than design, I feel - there's no purpose-written llvm-readobj LLVM style test).