projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ab9078f
)
[llvm-readobj] Check ELFType value first when checking for OpenBSD notes.
author
Frederic Cambus
<fred@statdns.com>
Mon, 20 Dec 2021 15:22:01 +0000
(16:22 +0100)
committer
Frederic Cambus
<fred@statdns.com>
Mon, 20 Dec 2021 15:32:02 +0000
(16:32 +0100)
Checking ELFType == ELF::ET_CORE first skips string comparison for the
majority of cases.
Suggested by Fangrui Song in D114635 for a similar construct.
llvm/tools/llvm-readobj/ELFDumper.cpp
patch
|
blob
|
history
diff --git
a/llvm/tools/llvm-readobj/ELFDumper.cpp
b/llvm/tools/llvm-readobj/ELFDumper.cpp
index
2f64b07
..
9d9c222
100644
(file)
--- a/
llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/
llvm/tools/llvm-readobj/ELFDumper.cpp
@@
-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())