[PATCH] D88294: [obj2yaml][yaml2obj] - Stop recognizing SHT_MIPS_ABIFLAGS on non-MIPS targets.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 05:08:45 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay, atanasyan.
Herald added subscribers: luismarques, s.egerton, lenary, PkmX, simoncook, hiraditya, kristof.beyls, arichardson, sdardis, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
grimar requested review of this revision.

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 <https://reviews.llvm.org/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`.


https://reviews.llvm.org/D88294

Files:
  llvm/lib/ObjectYAML/ELFYAML.cpp
  llvm/test/tools/obj2yaml/ELF/mips-abi-flags.yaml
  llvm/test/tools/yaml2obj/ELF/mips-abi-flags.yaml
  llvm/tools/obj2yaml/elf2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88294.294283.patch
Type: text/x-patch
Size: 4462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200925/e627fa9e/attachment.bin>


More information about the llvm-commits mailing list