[lld] r221552 - [mach-o] Fix MachOFileNode to own archives same as ELFFileNode
Nick Kledzik
kledzik at apple.com
Fri Nov 7 14:00:23 PST 2014
Author: kledzik
Date: Fri Nov 7 16:00:23 2014
New Revision: 221552
URL: http://llvm.org/viewvc/llvm-project?rev=221552&view=rev
Log:
[mach-o] Fix MachOFileNode to own archives same as ELFFileNode
My previous fix to have FileArchive own the member MemoryBuffers was not a
complete solution for darwin because nothing owned the FileArchive object.
Fixed MachOFileNode to be like ELFFileNode and have the graph node own the
archive object.
Modified:
lld/trunk/include/lld/Driver/DarwinInputGraph.h
lld/trunk/lib/Driver/DarwinInputGraph.cpp
Modified: lld/trunk/include/lld/Driver/DarwinInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/DarwinInputGraph.h?rev=221552&r1=221551&r2=221552&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/DarwinInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/DarwinInputGraph.h Fri Nov 7 16:00:23 2014
@@ -17,6 +17,7 @@
#ifndef LLD_DRIVER_DARWIN_INPUT_GRAPH_H
#define LLD_DRIVER_DARWIN_INPUT_GRAPH_H
+#include "lld/Core/ArchiveLibraryFile.h"
#include "lld/Core/InputGraph.h"
#include "lld/ReaderWriter/MachOLinkingContext.h"
@@ -67,6 +68,7 @@ private:
void narrowFatBuffer(StringRef filePath);
MachOLinkingContext &_context;
+ std::unique_ptr<const ArchiveLibraryFile> _archiveFile;
bool _isWholeArchive;
bool _upwardDylib;
};
Modified: lld/trunk/lib/Driver/DarwinInputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinInputGraph.cpp?rev=221552&r1=221551&r2=221552&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinInputGraph.cpp (original)
+++ lld/trunk/lib/Driver/DarwinInputGraph.cpp Fri Nov 7 16:00:23 2014
@@ -88,7 +88,10 @@ std::error_code MachOFileNode::parse(con
// If file is an archive and -all_load, then add all members.
if (ArchiveLibraryFile *archive = dyn_cast<ArchiveLibraryFile>(pf.get())) {
if (_isWholeArchive) {
- // Note: the members are added to _files, but the archive is not.
+ // Have this node own the FileArchive object.
+ _archiveFile.reset(archive);
+ pf.release();
+ // Add all members to _files vector
return archive->parseAllMembers(_files);
}
}
More information about the llvm-commits
mailing list