[llvm] r244195 - COFF: Assign the correct symbol type to internal functions.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 22:26:35 PDT 2015


Author: pcc
Date: Thu Aug  6 00:26:35 2015
New Revision: 244195

URL: http://llvm.org/viewvc/llvm-project?rev=244195&view=rev
Log:
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.

Added:
    llvm/trunk/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64   (with props)
    llvm/trunk/test/tools/llvm-objdump/X86/coff-dis-internal.test
Modified:
    llvm/trunk/lib/Object/COFFObjectFile.cpp

Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=244195&r1=244194&r2=244195&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Thu Aug  6 00:26:35 2015
@@ -186,10 +186,10 @@ SymbolRef::Type COFFObjectFile::getSymbo
   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())

Added: llvm/trunk/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64?rev=244195&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64 (added) and llvm/trunk/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64 Thu Aug  6 00:26:35 2015 differ

Propchange: llvm/trunk/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64
------------------------------------------------------------------------------
    svn:executable = *

Added: llvm/trunk/test/tools/llvm-objdump/X86/coff-dis-internal.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/X86/coff-dis-internal.test?rev=244195&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/X86/coff-dis-internal.test (added)
+++ llvm/trunk/test/tools/llvm-objdump/X86/coff-dis-internal.test Thu Aug  6 00:26:35 2015
@@ -0,0 +1,3 @@
+RUN: llvm-objdump -d %p/Inputs/internal.exe.coff-x86_64 | FileCheck %s
+
+CHECK: callq {{.*}} <foo>




More information about the llvm-commits mailing list