From: Peter Collingbourne Date: Thu, 6 Aug 2015 05:26:35 +0000 (+0000) Subject: COFF: Assign the correct symbol type to internal functions. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f4fa49e750dd969f352ab65e20436f39a669594f;p=oota-llvm.git COFF: Assign the correct symbol type to internal functions. The COFFSymbolRef::isFunctionDefinition() function tests for several conditions that are not related to whether a symbol is a function, but rather whether the symbol meets the requirements for a function definition auxiliary record, which excludes certain symbols such as internal functions and undefined references. The test we need to determine the symbol type is much simpler: we only need to compare the complex type against IMAGE_SYM_DTYPE_FUNCTION. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244195 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp index d110b9293ba..fa6aa4ced39 100644 --- a/lib/Object/COFFObjectFile.cpp +++ b/lib/Object/COFFObjectFile.cpp @@ -186,10 +186,10 @@ SymbolRef::Type COFFObjectFile::getSymbolType(DataRefImpl Ref) const { COFFSymbolRef Symb = getCOFFSymbol(Ref); int32_t SectionNumber = Symb.getSectionNumber(); + if (Symb.getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION) + return SymbolRef::ST_Function; if (Symb.isAnyUndefined()) return SymbolRef::ST_Unknown; - if (Symb.isFunctionDefinition()) - return SymbolRef::ST_Function; if (Symb.isCommon()) return SymbolRef::ST_Data; if (Symb.isFileRecord()) diff --git a/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64 b/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64 new file mode 100755 index 00000000000..0c38deb7cf0 Binary files /dev/null and b/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64 differ diff --git a/test/tools/llvm-objdump/X86/coff-dis-internal.test b/test/tools/llvm-objdump/X86/coff-dis-internal.test new file mode 100644 index 00000000000..530dadc8142 --- /dev/null +++ b/test/tools/llvm-objdump/X86/coff-dis-internal.test @@ -0,0 +1,3 @@ +RUN: llvm-objdump -d %p/Inputs/internal.exe.coff-x86_64 | FileCheck %s + +CHECK: callq {{.*}}