This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Enable tools such as llvm-objdump to process objects with unrecognised base ISA versions
ClosedPublic

Authored by asb on Mar 14 2023, 10:30 AM.

Details

Summary

Tools such as llvm-objdump will currently inputs when the base ISA has an unrecognised version. I addressed a similar issue in LLD in D144353, introducing parseArchStringNormalized. While it would make sense to migrate llvm/lib/Object/ELFObjectFile.cpp to using parseArchStringNormalized as well, this patch takes a less ambitious initial step. By tweaking the behaviour of parseArchString when IgnoreUnknown is true (which only has one in-tree user), we use the default supported ISA version when a base ISA with unrecognised version is encountered.

This means that llvm-objdump and related tools will function better for objects produced from a recent GCC. This isn't a full fix, as IgnoreUnknown means that an imafd object with attributes specifying newer A/F/D versions will have those extensions ignored.

Diff Detail

Event Timeline

asb created this revision.Mar 14 2023, 10:30 AM
Herald added a project: Restricted Project. · View Herald Transcript
asb requested review of this revision.Mar 14 2023, 10:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2023, 10:30 AM
craig.topper added inline comments.Mar 23 2023, 3:42 PM
llvm/unittests/Support/RISCVISAInfoTest.cpp
289

This needs to be rebased. RISCVExtensionInfo doesn't contain the string anymore.

asb updated this revision to Diff 508418.Mar 26 2023, 7:45 AM

Rebase (to account for removal of string from RISCVExtensionInfo. The following patches have been approved, so just waiting for approval of this to land the series.

This revision is now accepted and ready to land.Mar 26 2023, 4:04 PM