diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -222,8 +222,23 @@ static bool QuietDisasm; +// Enumeration of function kinds, and their mapping to function kind values +// from call graph section (.callgraph). +enum FunctionKind { + // Function cannot be target to indirect calls. + NOT_INDIRECT_TARGET = 0, + // Function may be target to indirect calls but its type id is unknown. + INDIRECT_TARGET_UNKNOWN_TID = 1, + // Function may be target to indirect calls and its type id is known. + INDIRECT_TARGET_KNOWN_TID = 2, + + // Available in the binary but not listed in the call graph section. + NOT_LISTED = -1, +}; + struct FunctionInfo { std::string Name; + FunctionKind Kind; using DirectCallSite = std::pair; SmallVector DirectCallSites; @@ -1383,6 +1398,8 @@ auto FuncPc = Symbols[SI].Addr; auto FuncName = Symbols[SI].Name.str(); FuncInfo[FuncPc].Name = FuncName; + // Initalize to be later updated while parsing the call graph section. + FuncInfo[FuncPc].Kind = NOT_LISTED; } while (Index < End) { // ARM and AArch64 ELF binaries can interleave data and text in the