[llvm-readobj] Check ELFType value first when checking for OpenBSD notes.

Checking ELFType == ELF::ET_CORE first skips string comparison for the
majority of cases.

Suggested by Fangrui Song in D114635 for a similar construct.
This commit is contained in:
Frederic Cambus 2021-12-20 16:22:01 +01:00
parent ab9078f3d3
commit f6ba5c4d5f
1 changed files with 1 additions and 1 deletions

View File

@ -5492,7 +5492,7 @@ StringRef getNoteTypeName(const typename ELFT::Note &Note, unsigned ELFType) {
return Result;
return FindNote(CoreNoteTypes);
}
if (Name.startswith("OpenBSD") && ELFType == ELF::ET_CORE) {
if (ELFType == ELF::ET_CORE && Name.startswith("OpenBSD")) {
// OpenBSD also places the generic core notes in the OpenBSD namespace.
StringRef Result = FindNote(OpenBSDCoreNoteTypes);
if (!Result.empty())