This is an archive of the discontinued LLVM Phabricator instance.

[obj2yaml][yaml2obj] - Stop recognizing SHT_MIPS_ABIFLAGS on non-MIPS targets.
ClosedPublic

Authored by grimar on Sep 25 2020, 5:08 AM.

Details

Summary

Currently we are always recognizing the SHT_MIPS_ABIFLAGS section,
even on non-MIPS targets.

The problem of doing this is briefly discussed in D88228 which does the same for SHT_ARM_EXIDX:

"The problem is that SHT_ARM_EXIDX shares the value with SHT_X86_64_UNWIND (0x70000001U).
We might have other machine specific conflicts, e.g.
SHT_ARM_ATTRIBUTES vs SHT_MSP430_ATTRIBUTES vs SHT_RISCV_ATTRIBUTES (0x70000003U)."

I think we should only recognize target specific sections when the machine type
matches. I.e. SHT_MIPS_* should be recognized only on MIPS, SHT_ARM_*
only on ARM etc.

This patch stops recognizing SHT_MIPS_ABIFLAGS on non-MIPS targets.

Note: I had to update ScalarEnumerationTraits<ELFYAML::MIPS_ISA>::enumeration, because
otherwise the new test crashes, calling llvm_unreachable.

Diff Detail

Event Timeline

grimar created this revision.Sep 25 2020, 5:08 AM
grimar requested review of this revision.Sep 25 2020, 5:08 AM
grimar edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Sep 25 2020, 11:59 AM