diff --git a/SMPFunction.cpp b/SMPFunction.cpp index de400ef8c9899a9e675206a0bacd2e8d8bfca68e..f04fdb115fd13a99a63498d1f3829f9c31f16274 100644 --- a/SMPFunction.cpp +++ b/SMPFunction.cpp @@ -2476,8 +2476,10 @@ void SMPFunction::SetLinks(void) { // we cannot conclude that a block with no predecessors is unreachable. Also, the block // order might be such that removal of a block makes an already processed block // unreachable, so we have to iterate until there are no more changes. + // NOTE: An odd new gcc recursion optimization uses indirect calls within the function, so + // they can behave like indirect jumps. #if SMP_USE_SWITCH_TABLE_INFO - if (!(this->HasUnresolvedIndirectJumps())) { + if (!(this->HasUnresolvedIndirectJumps() || this->HasUnresolvedIndirectCalls())) { #else if (!(this->HasIndirectJumps())) { #endif @@ -2629,10 +2631,13 @@ void SMPFunction::RPONumberBlocks(void) { // (no predecessors from SetLinks() because they are reached only via indirect // jumps). We need to number these and push them on the RPOBlocks vector so // that the vector contains all the blocks. - if (this->HasIndirectJumps()) { + // NOTE: Odd new gcc recursion optimization seems to use indirect calls to reach + // some blocks within a recursive function, operating somewhat like an indirect + // jump. + if (this->HasIndirectJumps() || this->HasIndirectCalls()) { for (CurrBlock = this->Blocks.begin(); CurrBlock != this->Blocks.end(); ++CurrBlock) { if (SMP_BLOCKNUM_UNINIT == CurrBlock->GetNumber()) { - msg("Numbering indirectly reachable block at %x\n", CurrBlock->GetFirstAddr()); + msg("WARNING: Numbering indirectly reachable block at %x\n", CurrBlock->GetFirstAddr()); CurrBlock->SetNumber(CurrNum); this->RPOBlocks.push_back(CurrBlock); ++CurrNum; @@ -2773,7 +2778,7 @@ void SMPFunction::ComputeIDoms(void) { } if (NewIdom == SMP_BLOCKNUM_UNINIT) { msg("Failure on NewIdom in ComputeIDoms for %s\n", this->GetFuncName()); - if (this->HasIndirectJumps()) { + if (this->HasIndirectJumps() || this->HasIndirectCalls()) { // Might be reachable only through indirect jumps. NewIdom = 0; // make it dominated by entry block } diff --git a/SMPStaticAnalyzer.cpp b/SMPStaticAnalyzer.cpp index 31db49c74bef78ae5ffca5712edae6447732ad43..666cfda52a69179e89880b58c17b0f2b9d718cca 100644 --- a/SMPStaticAnalyzer.cpp +++ b/SMPStaticAnalyzer.cpp @@ -229,6 +229,9 @@ void IDAP_run(int arg) { #if SMP_DEBUG msg("Beginning IDAP_run.\n"); #endif + + msg("IDA SDK version: %d \n", IDA_SDK_VERSION); + // Open the output file. ssize_t FileLen; FileLen = get_root_filename(RootFileName, sizeof(RootFileName) - 1);