When listing the index in llvm-objdump -h, use a zero-based counter instead of the actual section index (e.g. shdr->sh_index for ELF).
While this is effectively a noop for now (except one unit test for XCOFF), the index values will change in a future patch that filters certain sections out (e.g. symbol tables). See D68669 for more context. Note: the test case in test/tools/llvm-objdump/X86/section-index.s already covers the case of incrementing the section index counter when sections are skipped.
I think this needs a full comment (it does not give an information about what this helper avtually do atm):
I.e. would be nice to see something like: