From e834f4207320f4a0eb809e3d7494c8055c668cb3 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Thu, 6 Aug 2015 05:26:35 +0000 Subject: [PATCH] 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. llvm-svn: 244195 --- llvm/lib/Object/COFFObjectFile.cpp | 4 ++-- .../llvm-objdump/X86/Inputs/internal.exe.coff-x86_64 | Bin 0 -> 6144 bytes llvm/test/tools/llvm-objdump/X86/coff-dis-internal.test | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100755 llvm/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64 create mode 100644 llvm/test/tools/llvm-objdump/X86/coff-dis-internal.test diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index d110b92..fa6aa4c 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/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/llvm/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64 b/llvm/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64 new file mode 100755 index 0000000000000000000000000000000000000000..0c38deb7cf0bb88f8d30e6f69f8dc73ce8feaf48 GIT binary patch literal 6144 zcmeI0y-EX75QS%dP{G0=B6ho2rMmbC7ePoPSX*U7Oq-BwkyawszEdoH4=pTwgY}&I z6E<;M5zGvkyLZmaW|?odxpR9jon|}LZILy1HzMQb%qPx84zc@^OF2%lq31r;D{-ZZ z*o12jj{E`luy_@VfH_zu!^ce!w4d=t@i*Nt4KnW-TC7=Y9 zKqrAxB!LUgm^`Bw@FSi#)%JqGdg9ES6i=?-!RoXB@!mAe%V71|U%#pSZvt)>hc}<( ziR9ON@yTnGEdp^KNr@xIOpG5qx*C2RP)3V|3$X+xOed*w_KTV@|D@t;CetYcXQ`B^ V8C7!^ai&Qnjl*GIr0X9L_y!zxswV&d literal 0 HcmV?d00001 diff --git a/llvm/test/tools/llvm-objdump/X86/coff-dis-internal.test b/llvm/test/tools/llvm-objdump/X86/coff-dis-internal.test new file mode 100644 index 0000000..530dadc --- /dev/null +++ b/llvm/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 {{.*}} -- 2.7.4