summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/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
commitfcf5ef7a4a1014c821ad3a549a1ca20715c72d62 (patch)
treefe4775eca9e6f49cc2def27de5f0ccd597137da0 /llvm/lib/Bytecode/Archive/ArchiveWriter.cpp
parenta67b6e18743ab0dd4a440b9f502bd2ade0e848d9 (diff)
downloadbcm5719-llvm-fcf5ef7a4a1014c821ad3a549a1ca20715c72d62.tar.gz
bcm5719-llvm-fcf5ef7a4a1014c821ad3a549a1ca20715c72d62.zip
Changes necessary to enable linking of archives without LLVM symbol tables.
llvm-svn: 17811
Diffstat (limited to 'llvm/lib/Bytecode/Archive/ArchiveWriter.cpp')
-rw-r--r--llvm/lib/Bytecode/Archive/ArchiveWriter.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/llvm/lib/Bytecode/Archive/ArchiveWriter.cpp b/llvm/lib/Bytecode/Archive/ArchiveWriter.cpp
index 727b2bfcdf4..fa4d9e64fde 100644
--- a/llvm/lib/Bytecode/Archive/ArchiveWriter.cpp
+++ b/llvm/lib/Bytecode/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();
}
}
OpenPOWER on IntegriCloud