getSectionIndexName was trying to fetch two things at once, which led to a somewhat tricky to understand interface involving passing output parameters in, and also made it hard to return Errors further up the stack.
This change is in preparation for changing the error handling.
Additionally, update a related test now that yaml2obj supports SHT_SYMTAB_SHNDX properly, and add missing LLVM-style coverage for symbols with shndx SHN_XINDEX. This test (after fixing) caught a mistake in my first attempt at this patch, hence I'm including it as part of this patch.
Depends on D69669.
Nice cleanup after the yaml2obj change D65446.