COFF: Skip internal symbols in bitcode files.

Differential Revision: http://reviews.llvm.org/D10319

llvm-svn: 239338
This commit is contained in:
Peter Collingbourne 2015-06-08 20:21:28 +00:00
parent cf82a16b8c
commit df637ea289
3 changed files with 35 additions and 5 deletions

View File

@ -257,9 +257,13 @@ std::error_code BitcodeFile::parse() {
}
for (unsigned I = 0, E = M->getSymbolCount(); I != E; ++I) {
lto_symbol_attributes Attrs = M->getSymbolAttributes(I);
if ((Attrs & LTO_SYMBOL_SCOPE_MASK) == LTO_SYMBOL_SCOPE_INTERNAL)
continue;
StringRef SymName = M->getSymbolName(I);
if ((M->getSymbolAttributes(I) & LTO_SYMBOL_DEFINITION_MASK) ==
LTO_SYMBOL_DEFINITION_UNDEFINED) {
int SymbolDef = Attrs & LTO_SYMBOL_DEFINITION_MASK;
if (SymbolDef == LTO_SYMBOL_DEFINITION_UNDEFINED) {
SymbolBodies.push_back(new (Alloc) Undefined(SymName));
} else {
SymbolBodies.push_back(new (Alloc) DefinedBitcode(SymName));

View File

@ -4,3 +4,7 @@ target triple = "x86_64-pc-windows-msvc"
define void @foo() {
ret void
}
define internal void @internal() {
ret void
}

View File

@ -54,16 +54,34 @@
; TEXT-01: Disassembly of section .text:
; TEXT-01-NEXT: .text:
; TEXT-01-NEXT: subq $40, %rsp
; TEXT-01-NEXT: callq 7
; TEXT-01-NEXT: callq 23
; TEXT-01-NEXT: xorl %eax, %eax
; TEXT-01-NEXT: addq $40, %rsp
; TEXT-01-NEXT: retq
; TEXT-01-NEXT: retq
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: retq
; HEADERS-10: AddressOfEntryPoint: 0x2010
; HEADERS-10: AddressOfEntryPoint: 0x2020
; TEXT-10: Disassembly of section .text:
; TEXT-10-NEXT: .text:
; TEXT-10-NEXT: retq
; TEXT-10-NEXT: nopw %cs:(%rax,%rax)
; TEXT-10-NEXT: retq
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
@ -80,7 +98,7 @@
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: int3
; TEXT-10-NEXT: subq $40, %rsp
; TEXT-10-NEXT: callq -25
; TEXT-10-NEXT: callq -41
; TEXT-10-NEXT: xorl %eax, %eax
; TEXT-10-NEXT: addq $40, %rsp
; TEXT-10-NEXT: retq
@ -104,3 +122,7 @@ $f2 = comdat any
define i32 @f2() comdat($f2) {
ret i32 2
}
define internal void @internal() {
ret void
}