summaryrefslogtreecommitdiff
path: root/lib/Archive/ArchiveWriter.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-11-15 01:20:11 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-11-15 01:20:11 +0000
commit766b793143fa863283498233e8962391da09b63a (patch)
tree7a344adee85815f8ae6dddff08bed62bf0d5529d /lib/Archive/ArchiveWriter.cpp
parent6238a85e4f6931a9572e5d327c3ffa7ce1087d50 (diff)
Changes necessary to enable linking of archives without LLVM symbol tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17811 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Archive/ArchiveWriter.cpp')
-rw-r--r--lib/Archive/ArchiveWriter.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/lib/Archive/ArchiveWriter.cpp b/lib/Archive/ArchiveWriter.cpp
index 727b2bfcdf4..fa4d9e64fde 100644
--- a/lib/Archive/ArchiveWriter.cpp
+++ b/lib/Archive/ArchiveWriter.cpp
@@ -197,19 +197,28 @@ Archive::writeMember(
if (CreateSymbolTable &&
(member.isBytecode() || member.isCompressedBytecode())) {
std::vector<std::string> symbols;
- GetBytecodeSymbols((const unsigned char*)data,fSize,member.getPath().get(),
- symbols);
- for (std::vector<std::string>::iterator SI = symbols.begin(),
- SE = symbols.end(); SI != SE; ++SI) {
-
- std::pair<SymTabType::iterator,bool> Res =
- symTab.insert(std::make_pair(*SI,filepos));
-
- if (Res.second) {
- symTabSize += SI->length() +
- numVbrBytes(SI->length()) +
- numVbrBytes(filepos);
+ ModuleProvider* MP = GetBytecodeSymbols(
+ (const unsigned char*)data,fSize,member.getPath().get(), symbols);
+
+ // If the bytecode parsed successfully
+ if ( MP ) {
+ for (std::vector<std::string>::iterator SI = symbols.begin(),
+ SE = symbols.end(); SI != SE; ++SI) {
+
+ std::pair<SymTabType::iterator,bool> Res =
+ symTab.insert(std::make_pair(*SI,filepos));
+
+ if (Res.second) {
+ symTabSize += SI->length() +
+ numVbrBytes(SI->length()) +
+ numVbrBytes(filepos);
+ }
}
+ // We don't need this module any more.
+ delete MP;
+ } else {
+ throw std::string("Can't parse bytecode member: ") +
+ member.getPath().get();
}
}