Do not destroy external linkage when deleting function body

The function deleteBody() converts the linkage to external and thus destroys
original linkage type value. Lack of correct linkage type causes wrong
relocations to be emitted later.
Calling dropAllReferences() instead of deleteBody() will fix the issue.

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

llvm-svn: 218302
This commit is contained in:
Petar Jovanovic committed 2014-09-23 12:54:19 +00:00
1 parent 40592d2dec
commit 7480e4db5e
2 files changed
+25 -1

No files matched your search

+1 -1
View File
@@ -3347,7 +3347,7 @@ void BitcodeReader::Dematerialize(GlobalValue *GV) {
assert(DeferredFunctionInfo.count(F) && "No info to read function later?");
// Just forget the function body, we can remat it later.
F->deleteBody();
F->dropAllReferences();
}
std::error_code BitcodeReader::MaterializeModule(Module *M) {