Skip to content

Commit

Permalink
include/llvm/Object/ELF.h: do debug checks only when NDEBUG
Browse files Browse the repository at this point in the history
validateSymbol() is called all over the place, and it seems it's a debug check.
It significantly speedups llvm-symbolizer used in tsan/asan/msan. validateSymbol() is the second hot function and accounts for 15% of runtime.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175192 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dvyukov committed Feb 14, 2013
1 parent 6cc4b8d commit 06121de
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/llvm/Object/ELF.h
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,7 @@ void ELFObjectFile<ELFT>::LoadVersionMap() const {

template<class ELFT>
void ELFObjectFile<ELFT>::validateSymbol(DataRefImpl Symb) const {
#ifndef NDEBUG
const Elf_Sym *symb = getSymbol(Symb);
const Elf_Shdr *SymbolTableSection = SymbolTableSections[Symb.d.b];
// FIXME: We really need to do proper error handling in the case of an invalid
Expand All @@ -881,6 +882,7 @@ void ELFObjectFile<ELFT>::validateSymbol(DataRefImpl Symb) const {
+ SymbolTableSection->sh_size)))
// FIXME: Proper error handling.
report_fatal_error("Symb must point to a valid symbol!");
#endif
}

template<class ELFT>
Expand Down

0 comments on commit 06121de

Please sign in to comment.