summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-08-06 05:26:35 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-08-06 05:26:35 +0000
commite834f4207320f4a0eb809e3d7494c8055c668cb3 (patch)
tree432b271104a777f95129b6f402e700a6bbda6590 /llvm
parent4cb29abcdbffd3e3df7c9ef7ba4a87fa713d0160 (diff)
downloadbcm5719-llvm-e834f4207320f4a0eb809e3d7494c8055c668cb3.tar.gz
bcm5719-llvm-e834f4207320f4a0eb809e3d7494c8055c668cb3.zip
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
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp4
-rwxr-xr-xllvm/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64bin0 -> 6144 bytes
-rw-r--r--llvm/test/tools/llvm-objdump/X86/coff-dis-internal.test3
3 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index d110b9293ba..fa6aa4ced39 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 00000000000..0c38deb7cf0
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/X86/Inputs/internal.exe.coff-x86_64
Binary files differ
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 00000000000..530dadc8142
--- /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 {{.*}} <foo>
OpenPOWER on IntegriCloud