Commit Graph

21 Commits

Author SHA1 Message Date
Eugene Zelenko 3c5c20aa2e Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D26320


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@286030 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-05 01:00:56 +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 00ec5d130c Rename atom_collection -> AtomVector.
Type names should start with an uppercase letter in the LLVM coding style.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@234452 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 23:05:59 +00:00
Rui Ueyama c4ff24478d Merge atom_collection_vector with atom_collection.
atom_collection_vector is the only derived class of atom_collection.
This patch merges the two.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@234443 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 21:59:04 +00:00
Rui Ueyama fc504f031c Remove atom_collection_empty class.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@234442 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 21:59:00 +00:00
Rui Ueyama b086a2feb3 Run the resolver in parallel with the reader.
This patch makes File::parse() multi-thread safe. If one thread is running
File::parse(), other threads will block if they try to call the same method.
File::parse() is idempotent, so you can safely call  multiple times.

With this change, we don't have to wait for all worker threads to finish
in Driver::link(). Previously, Driver::link() calls TaskGroup::sync() to
wait for all threads running File::parse(). This was not ideal because
we couldn't start the resolver until we parse all files.

This patch increase parallelism by making Driver::link() to not wait for
worker threads. The resolver calls parse() to make sure that the file
being read has been parsed, and then uses the file. In this approach,
the resolver can run with the parser threads in parallel.

http://reviews.llvm.org/D6994

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@226281 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 15:54:13 +00:00
Rui Ueyama 24e42ff54a Partially roll back r217324.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@217392 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-08 18:01:42 +00:00
Rui Ueyama a8927998ac Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@217324 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-07 01:23:16 +00:00
Rui Ueyama 6d67a8a4c2 Remove extraneous curly braces and blank lines.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@195107 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-19 06:18:39 +00:00
Rui Ueyama 5e17d4d2b3 Fix spelling error. s/Libary/Library/g.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@188049 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-09 04:19:54 +00:00
Nick Kledzik 9bff16ea08 Add SectionPosition and OrderPass
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@173300 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23 22:32:56 +00:00
Nick Kledzik 76a1de59e1 fix typo
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@171916 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-08 23:43:11 +00:00
Nick Kledzik 4d3f80ffb1 Removes files for separate ReaderYAML.cpp and WriterYAML.cpp
and adds a new file ReaderWriterYAML.cpp that uses YAML I/O.

Lots of tweaks to test suite for slightly different YAML encoding.


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@171592 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 02:22:35 +00:00
Nick Kledzik 6c5447010d Factor out core linking options from Platform in a new ResolverOptions
class.  Change Resolver to no longer use Platform.  Core linking
now issues errors directly.  We need to factor that out later.

Rework how Darwin executable writer finds "main" atom.  It now
adds to core linking an Atom  which has a Reference to "main".  


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@155060 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-18 21:55:06 +00:00
Nick Kledzik 0fe0f2a094 First implementation of Darwin Platform. It is rich enough to generate
a hello world executable from atoms.  There is still much to be flushed out.
Added one test case, test/darwin/hello-world.objtxt, which exercises the
darwin platform.

Added -platform option to lld-core tool to dynamically select platform.


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@154242 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-07 01:31:00 +00:00
Michael J. Spencer cc48bb94e8 Steal LLVM.h from Clang. This brings in very commonly used LLVM ADT/Support
types into the lld namespace.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@153963 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-03 18:39:40 +00:00
Nick Kledzik c1845dd934 Sources now require C++11 to build.
Add first linker pass (StubsPass) which looks for calls to shared library
symbols and replaces them with calls to a StubAtom.  On ELF system, a "stub"
is a PLT entry.  Added a simple test case.

Pass a Platform object to YAML reader and writer for converting fixup kinds 
between names and values.

Change output of Resolver to be a File object instead of a vector of Atoms.
Thus, passes operate on a File instead of just Atoms.

Rework how to walk through a File's Atoms. Now iterator based instead of 
a method that visits each atom.  



git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@152269 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-08 00:18:30 +00:00
Nick Kledzik 272eef937a Cleaned up Atom attribues some more. Added lots of doxygen comments
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@147105 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-21 23:29:36 +00:00
Michael J. Spencer 2ec63a3659 Initial commit. Code by Nick Kledzik. Cleanups and build system by me.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@146844 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-18 08:27:59 +00:00