Commit Graph

80 Commits

Author SHA1 Message Date
Mehdi Amini 6a4b837938 Prevent at compile time converting from Error::success() to Expected<T>
This would trigger an assertion at runtime otherwise.

Differential Revision: https://reviews.llvm.org/D26482

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@286562 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11 04:29:25 +00:00
Kevin Enderby f752b5c298 Needed change to lld for the changes to libObject/Archive interfaces now returning Expected<>
for the llvm trunk change in r277656


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@277657 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 21:58:48 +00:00
Kevin Enderby 29817df48b Matching change needed to lld for llvm trunk change r277177.
Where Archive::getMemoryBufferRef() was changed to return Expected<>


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@277183 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 17:56:00 +00:00
Lang Hames f83e27b899 [lld] Update LLD for Archive::child_iterator change in LLVM r275361.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@275362 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 02:35:18 +00:00
Kevin Enderby 9729e99db0 Matching change for lld for the llvm change of Archive::create() from ErrorOr<...> to Expected<...> in r274160.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@274161 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-29 20:36:11 +00:00
Eugene Zelenko c0574ad9cf Fix builds broken in r267008.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@267010 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21 17:27:04 +00:00
Eugene Zelenko fcf7d7cb1e Fix Clang-tidy misc-unused-using-decls and Include What You Use warnings.
Differential revision: http://reviews.llvm.org/D19348


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@267008 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21 17:14:10 +00:00
Rui Ueyama 7964984860 Remove dead flags.
searchArchivesToOverrideTentativeDefinitions and
searchSharedLibrariesToOverrideTentativeDefinitions are always false.
For the dead flags, we have a fairly large amount of code which is
never be executed.

http://reviews.llvm.org/D17791

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@264653 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-28 20:59:47 +00:00
Kevin Enderby 7deff4c690 Add the needed lld change for r264187 in llvm.
Sorry had this fixed in my check out but failed mention it in my
commit message for r264187.


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@264188 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23 20:37:23 +00:00
Pete Cooper 1eca6f241d Use owning pointers instead of raw pointers for Atom's to fix leaks.
This is a re-commit of r264022 with a fix for MSVC.  The issue there was
that the code was running DefinedAtom::~Atom() for some value and instead
needed to cast to Atom before running ~Atom.  Original commit message follows.

Currently each File contains an BumpPtrAllocator in which Atom's are
allocated.  Some Atom's contain data structures like std::vector which
leak as we don't run ~Atom when they are BumpPtrAllocate'd.

Now each File actually owns its Atom's using an OwningAtomPtr.  This
is analygous to std::unique_ptr and may be replaced by it if possible.

An Atom can therefore only be owned by a single File, so the Resolver now
moves them from one File to another.  The MachOLinkingContext owns the File's
and so clears all the Atom's in ~MachOLinkingContext, then delete's all the
File's.  This makes sure all Atom's have been destructed before any of the
BumpPtrAllocator's in which they run have gone away.

Should hopefully fix the remaining leaks.  Will keep an eye on the bots to
make sure.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@264067 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22 17:15:50 +00:00
Pete Cooper 81a9e77e30 Revert "Use owning pointers instead of raw pointers for Atom's to fix leaks."
This reverts commit r264022.

This breaks the Window's bots which don't like that i'm calling ~Atom when
the this pointer is a sublcass of Atom.

Reverting for now until I try find a better fix.  I tried using std::unique_ptr with
a custom deleter as a quick fix, but it didn't work well in the YAML parser.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@264023 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22 04:00:41 +00:00
Pete Cooper 0e55f8eae6 Use owning pointers instead of raw pointers for Atom's to fix leaks.
Currently each File contains an BumpPtrAllocator in which Atom's are
allocated.  Some Atom's contain data structures like std::vector which
leak as we don't run ~Atom when they are BumpPtrAllocate'd.

Now each File actually owns its Atom's using an OwningAtomPtr.  This
is analygous to std::unique_ptr and may be replaced by it if possible.

An Atom can therefore only be owned by a single File, so the Resolver now
moves them from one File to another.  The MachOLinkingContext owns the File's
and so clears all the Atom's in ~MachOLinkingContext, then delete's all the
File's.  This makes sure all Atom's have been destructed before any of the
BumpPtrAllocator's in which they run have gone away.

Should hopefully fix the remaining leaks.  Will keep an eye on the bots to
make sure.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@264022 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-22 03:44:32 +00:00
Rui Ueyama 22e3258156 Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@262436 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 00:43:37 +00:00
Rui Ueyama eebfb52fb4 Make a few utility functions file-scoped.
makeErrorFile and parseMemberFiles are now used only in DarwinLdDriver.cpp.
This patch moves them to that file.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@262423 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 23:52:04 +00:00
Rui Ueyama 826cefae1a Remove dead code for ELF.
The preload feature was buggy that we had disabled it even for ELF.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@262194 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-28 21:22:44 +00:00
Rui Ueyama ac52e22e86 Remove remaining code for COFF.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@262193 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-28 21:22:40 +00:00
Kevin Enderby b20298d4cc These are the matching changes needed to the lld project for the changes to llvm
in r252192 that changed the Archive and Child interfaces in libObject. These include
Rafael Espindola’s many suggested updates.


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@252193 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-05 19:25:47 +00:00
Rui Ueyama c8713dd65e Fix memory leak in FileArchive::find().
Patch from George Rimar!

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@248525 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-24 18:59:26 +00:00
Rafael Espindola 5a647fc99f Update for llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@242216 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-14 22:19:09 +00:00
Rafael Espindola e18345379c Update for upcoming llvm change.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@241746 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-08 22:14:36 +00:00
Rafael Espindola d40c87ab33 Update for llvm changes.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@241298 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-02 20:55:28 +00:00
Rafael Espindola 51fb1273cf Update for llvm changes.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@240781 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-26 13:19:38 +00:00
Rafael Espindola 34cda6e0db Use MemoryBufferRef instead of MemoryBuffer&. NFC.
This just reduces the noise from another patch.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@235776 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24 21:10:50 +00:00
Rafael Espindola 8ed597952e Simplify now that there is only one file. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@235747 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24 19:01:30 +00:00
Rafael Espindola 17d70bfdbf Return ErrorOr<std::unique_ptr<File>>. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@235744 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24 18:51:30 +00:00