Michael J. Spencer
cadb082e5a
[ELF] Fix memory leak by deleting BumpPtr allocated objects.
...
llvm-svn: 175558
2013-02-19 21:04:30 +00:00
Michael J. Spencer
be03e2a861
[Core,Driver,ELF] Differentiate static and dynamic executables.
...
This also adds a simple relocation change for dynamic executables to
x86-64 ELF.
llvm-svn: 175208
2013-02-14 20:32:00 +00:00
Shankar Easwaran
96d594b14e
add merge strings option, this temporarily fixes the problem bringing up helloworld with glibc on x86_64
...
llvm-svn: 175038
2013-02-13 06:12:52 +00:00
Michael J. Spencer
c3c8bc1e5c
[ELF] Add support for reading dynamic libraries.
...
llvm-svn: 174916
2013-02-11 23:03:35 +00:00
Shankar Easwaran
34ab70f1e6
add changes for layoutafter/layoutbefore/ingroup/layoutpass and test cases
...
llvm-svn: 174658
2013-02-07 20:16:12 +00:00
Michael J. Spencer
7799d15f6e
[Driver] Add -L and -l support.
...
llvm-svn: 174590
2013-02-07 06:47:17 +00:00
Michael J. Spencer
cfe59fd0d3
[Driver] Replace Target with TargetInfo. Simplify LinkerInput.
...
This removes Target and moves the functionality it had over to TargetInfo.
This also simplifies LinkerInput by removing the InputKind. This will be handled elsewhere.
llvm-svn: 174589
2013-02-07 06:46:48 +00:00
Michael J. Spencer
280dadbbaf
[Core] Only complain about undefined symbols if they are marked as canBeNullNever.
...
llvm-svn: 174107
2013-01-31 22:56:13 +00:00
Michael J. Spencer
b3c04d28c8
[ELF] Fix circular initialization bug.
...
llvm-svn: 173968
2013-01-30 20:36:56 +00:00
Shankar Easwaran
072031a265
change the function names in RelocationHelper to adhere to convention
...
llvm-svn: 173908
2013-01-30 07:36:09 +00:00
Shankar Easwaran
a51870b143
add Relocation helper functions
...
llvm-svn: 173895
2013-01-30 04:49:54 +00:00
Michael J. Spencer
e68f90355c
[ELF] Chop the ELF prefix off of most things.
...
llvm-svn: 173838
2013-01-29 22:03:39 +00:00
Michael J. Spencer
289dcedea5
[ELF] Add support for IFUNC.
...
This sadly doesn't have a test for the final
output because llvm-objdump can't dump relocations
that don't belong to a section :(
llvm-svn: 173808
2013-01-29 16:38:03 +00:00
Michael J. Spencer
990ec2b223
[ELF] Use entry point from LinkerOptions.
...
Patch by Ahmed Bougacha!
llvm-svn: 173655
2013-01-28 04:15:44 +00:00
Michael J. Spencer
866e0f8a8c
[ELF][X86-64] Use the correct base address.
...
llvm-svn: 173527
2013-01-25 23:23:24 +00:00
Shankar Easwaran
3256d4ff62
add elf targethandler
...
llvm-svn: 173430
2013-01-25 07:39:18 +00:00
Michael J. Spencer
88f4d24e4a
[Driver] Run the pass manager.
...
llvm-svn: 173381
2013-01-24 22:52:42 +00:00
Michael J. Spencer
19c4756ff2
Move SimpleAtoms.h to ReaderWriter.
...
llvm-svn: 173380
2013-01-24 22:52:25 +00:00
Nick Kledzik
36293f6512
Add SectionPosition and OrderPass
...
llvm-svn: 173300
2013-01-23 22:32:56 +00:00
Michael J. Spencer
c0d3c4efe6
Add PassManager.
...
It owns and manages passes.
llvm-svn: 173287
2013-01-23 20:03:10 +00:00
Shankar Easwaran
c142874c9c
change from using 2 bits to 4 bits, as 2 bits arent enough to hold the enumeration OutputKind
...
llvm-svn: 173266
2013-01-23 15:11:22 +00:00
Michael J. Spencer
64afcb4c6b
Move everything over to TargetInfo.
...
I really would have liked to split this patch up, but it would greatly
complicate the lld-core and lld drivers having to deal with both
{Reader,Writer}Option and TargetInfo.
llvm-svn: 173217
2013-01-23 01:18:43 +00:00
Michael J. Spencer
4586fbcbad
[Core] Move Resolver and SymbolTable over to TargetInfo.
...
No functionality change.
llvm-svn: 173192
2013-01-22 20:49:42 +00:00
Shankar Easwaran
58ad41b563
change enum class to enum, as g++ doesnot support bitfields with enumerated classes with c++11 flag set
...
llvm-svn: 173166
2013-01-22 14:58:51 +00:00
Shankar Easwaran
c7176430dc
it looks like g++ 4.7.2 doesnot like bit fields when the type is a enumeration (Throws an error as bit-field with non integral type)
...
llvm-svn: 173125
2013-01-22 04:12:03 +00:00
Michael J. Spencer
d68d6196af
Add {,ELF,MachO}TargetInfo.
...
llvm-svn: 173117
2013-01-22 02:15:30 +00:00
Michael J. Spencer
8af48f3864
[Core] Use LLVM's ErrorOr<T>.
...
llvm-svn: 172993
2013-01-20 21:27:05 +00:00
Chandler Carruth
058761266d
Fix the build with libstdc++ v4.6 on Linux by supplying an explicit move
...
assignment operator. There is an issue where classes with deleted copy
constructors and user defined move constructors end up with an
implicitly deleted copy constructor that is selected instead of the
implicit move constructor. This is a bit of a hack, but it allows me to
build LLD in a bootstrap with libstdc++ which is my primary goal.
llvm-svn: 172896
2013-01-19 09:38:14 +00:00
Michael J. Spencer
a17b72e7cf
[Core] Fix passing an rvalue reference of ErrorOr.
...
llvm-svn: 172850
2013-01-18 21:42:01 +00:00
Michael J. Spencer
aa3aa570dc
[Core] Add iterator ranges.
...
This is based on code by Jeffrey Yasskin. It has been modified to compile
with MSVC and reformated to LLVM style.
llvm-svn: 172512
2013-01-15 06:55:25 +00:00
Nick Kledzik
233f537799
Add new merge-by-content Merge attribute for use by anonymous
...
constants and string literals which the linker should coalesce.
llvm-svn: 172495
2013-01-15 00:17:57 +00:00
Michael J. Spencer
57752dc56e
Factor File::addAtom out to MutableFile::addAtom.
...
This removes a bunch of llvm_unreachables and makes a File's mutability part of the type system.
llvm-svn: 172297
2013-01-12 02:45:54 +00:00
Shankar Easwaran
7381db059a
add noinhibit exec option
...
llvm-svn: 172204
2013-01-11 15:11:47 +00:00
Michael J. Spencer
41d9dc56d3
Style fixes.
...
llvm-svn: 171997
2013-01-09 20:39:07 +00:00
Nick Kledzik
cc3d2dca60
Better tie together ContentType and Permissions.
...
Since most content types (e.g. typeCode) have a
preferred Permission, add a function to do that mapping.
Then hook up to YAML Reader and Writer such that
the 'permissions:' key does not need to be specified unless
overriding what the content type prefers.
llvm-svn: 171929
2013-01-09 01:17:12 +00:00
Michael J. Spencer
6047163a24
[lld] Add support for -mllvm.
...
There is no way to test this at the moment because the options are not
processed until the link starts, and we can't pass an empty file.
llvm-svn: 171910
2013-01-08 22:59:27 +00:00
Michael J. Spencer
956b03618c
[lld] Add -emit-yaml option. This outputs yaml instead of a binary.
...
llvm-svn: 171710
2013-01-07 08:00:25 +00:00
Nick Kledzik
6b079f5e2f
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.
llvm-svn: 171592
2013-01-05 02:22:35 +00:00
Michael J. Spencer
18225e7be1
[Driver] Add -flavor core support. This will be tested by other tests using -flavor core.
...
llvm-svn: 171577
2013-01-05 00:46:45 +00:00
Michael J. Spencer
552074f18e
Style fixes.
...
llvm-svn: 171531
2013-01-04 21:18:34 +00:00
Shankar Easwaran
495d38bf46
add Changes to ELF Writer to layout sections/segments in the output executable
...
llvm-svn: 171135
2012-12-27 02:26:30 +00:00
Shankar Easwaran
bbf9ddda04
changes for the ELF Reader : split up into AtomsELF.h/Adding new permissions permRWX
...
llvm-svn: 171127
2012-12-27 01:40:08 +00:00
Andy Gibbs
d02bf1d232
Fix build issue when building lld against libstdc++ 4.7
...
llvm-svn: 170983
2012-12-22 09:46:10 +00:00
Michael J. Spencer
800de03813
[Core][ErrorOr] Add support for user error data.
...
llvm-svn: 170483
2012-12-19 00:51:07 +00:00
Michael J. Spencer
3825760550
[Driver] Add -### support for printing out the core command line.
...
llvm-svn: 169717
2012-12-09 23:56:26 +00:00
Michael J. Spencer
9ff4be240a
Add the core architecture for the lld driver.
...
This includes selecting which driver to emulate, option parsing, invocation
building, and running the link. This currently only supports a very basic
subset of ld for x86_64-linux.
lld -flavor ld obj.o -o obj
or symlink lld as (ld , link, ld64, core) to get the desired behavior without
-flavor.
llvm-svn: 169659
2012-12-08 00:47:36 +00:00
Hemant Kulkarni
736f7fbee2
Populate entry point into ELF executable.
...
llvm-svn: 168461
2012-11-21 21:07:36 +00:00
Hemant Kulkarni
87dbac00a9
Add program header emission to ELF writer. This patch also rearranges sections for efficient memory utilization
...
llvm-svn: 167874
2012-11-13 21:34:45 +00:00
Michael J. Spencer
a5d22811af
Fix style violations.
...
llvm-svn: 167869
2012-11-13 19:58:58 +00:00
Shankar Easwaran
70b4dcfbcd
Adding support to resolve symbols with archive libraries in lld
...
llvm-svn: 167854
2012-11-13 18:39:10 +00:00
Sid Manning
2a59024ff8
This update does the following:
...
* Moves enum Scope from DefinedAtom.h to Atom.h
* Adds scope method to AbsoluteAtom class
* Updates YAML to print scope of AbsoluteAtoms
* Update Native Reader/Writer to handle this new, "attribute"
* Adds testcase
Reviewed and approved by Nick Kledzik
llvm-svn: 166189
2012-10-18 17:16:19 +00:00
Hemant Kulkarni
08e410293f
Emit symbol tables.
...
Reorganize to derive all sections from SectionChunk.
Construct section table header from SectionChunk.
llvm-svn: 164981
2012-10-01 23:53:20 +00:00
Hemant Kulkarni
927bbc2871
ELF support for LLD writer. The writer at present emits ELF header and section
...
table header. Skeleton code for ReferenceKinds.
Credits:
Doxygen by Michael Spencer.
Origianl implementation from Macho by Sidney Manning.
Templatization, implementation of section header chunks, string table, ELF header by Hemant Kulkarni.
llvm-svn: 163906
2012-09-14 16:11:34 +00:00
Nick Kledzik
40b68559e8
Move implementation of WriterOptionsMachO to its own file. Reduced redundant
...
ivars in WriterOptionsMachO instead have its methods compute ivar interactions.
Refactor mach-o Reference Kinds and introduce abstract class KindHandler.
Split up StubAtoms.hpp by architecture. Add support for 32-bit x86 stubs.
llvm-svn: 158336
2012-06-11 22:53:15 +00:00
Nick Kledzik
98211f6d19
fix warnings found after cranking up warnings
...
llvm-svn: 158134
2012-06-07 01:53:39 +00:00
Michael J. Spencer
56d756dc33
Add missing include.
...
llvm-svn: 157834
2012-06-01 20:22:59 +00:00
Nick Kledzik
abb6981f68
Major refactoring: Remove Platform concept. In its place there are
...
now Reader and Writer subclasses for each file format. Each Reader and
Writer subclass defines an "options" class which controls how that Reader
or Writer operates.
llvm-svn: 157774
2012-05-31 22:34:00 +00:00
Filipe Cabecinhas
6f970e8458
Remove some compilation warnings.
...
llvm-svn: 157253
2012-05-22 14:45:44 +00:00
Michael J. Spencer
60d835fa59
Add COFF reader.
...
There are no tests for this yet because I still need to finish the
YAML -> COFF converter so we don't get binary files checked in.
llvm-svn: 156100
2012-05-03 20:52:22 +00:00
Michael J. Spencer
d0d5ec4a38
Convert the YAMLReader to use LLVM/Support/YAMLParser.
...
llvm-svn: 155847
2012-04-30 21:20:13 +00:00
Nick Kledzik
20e652d627
Add way to represent static archives in yaml test cases.
...
Add SharedLibraryFile and ArchiveLibraryFile subclasses of File.
Add command line options to lld-core to set various ResolverOptions settings
and added lots of test cases to verify the options work.
llvm-svn: 155183
2012-04-20 01:24:37 +00:00
Nick Kledzik
bb963dfb7e
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".
llvm-svn: 155060
2012-04-18 21:55:06 +00:00
Nick Kledzik
467209b1d4
Remove definedAtomsBegin() and co. so that C++11 range based for loops can be used
...
llvm-svn: 154302
2012-04-09 00:58:21 +00:00
Nick Kledzik
062a98cff0
Rename referencesBegin() to begin() so that C++11 range based for loops can be used
...
llvm-svn: 154301
2012-04-08 23:52:13 +00:00
Michael J. Spencer
d73a53f158
[docs] Add more open projects.
...
llvm-svn: 154277
2012-04-08 03:47:49 +00:00
Michael J. Spencer
f9bc125c5a
[docs] Add open projects page that includes the TODO.txt files.
...
llvm-svn: 154274
2012-04-07 23:10:01 +00:00
Nick Kledzik
5a1528f49d
Add to-do lists
...
llvm-svn: 154246
2012-04-07 01:54:17 +00:00
Nick Kledzik
b334be1ed2
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.
llvm-svn: 154242
2012-04-07 01:31:00 +00:00
Michael J. Spencer
765792d5d1
Remove trailing whitespace.
...
llvm-svn: 153964
2012-04-03 18:40:27 +00:00
Michael J. Spencer
e6203a57b5
Steal LLVM.h from Clang. This brings in very commonly used LLVM ADT/Support
...
types into the lld namespace.
llvm-svn: 153963
2012-04-03 18:39:40 +00:00
Michael J. Spencer
b495562b5d
Use the LLVM RTTI library.
...
llvm-svn: 153912
2012-04-02 23:56:36 +00:00
Michael J. Spencer
c9d2506a76
Replace all uses of NULL with nullptr.
...
llvm-svn: 153677
2012-03-29 19:39:14 +00:00
Michael J. Spencer
d58cf03cff
llvm::OwningPtr -> std::unique_ptr.
...
llvm-svn: 153620
2012-03-29 00:49:50 +00:00
Michael J. Spencer
cfd029fd91
Rearange header order to match llvm style. This exposed some missing types.
...
Also fix some Platform.h includes that somehow got missed last time.
llvm-svn: 153590
2012-03-28 19:04:02 +00:00
Michael J. Spencer
87c2994e24
Move Platform.h to Core as Core depends on Platform.h, and the Platform
...
library depends on Core. This breaks that cycle.
llvm-svn: 153589
2012-03-28 18:49:17 +00:00
Nick Kledzik
f4e2c73fa7
Add Pass to instantiate GOT entries
...
llvm-svn: 152874
2012-03-15 23:36:24 +00:00
Michael J. Spencer
e753cbc685
Fix MSVC incompatibilities.
...
llvm-svn: 152389
2012-03-09 05:27:43 +00:00
Michael J. Spencer
9f91f958b1
Use llvm/Support/DataTypes instead of stdint.h
...
llvm-svn: 152387
2012-03-09 05:27:11 +00:00
Michael J. Spencer
4ff3c79998
Use nullptr instead of NULL, and remove use of VLA.
...
llvm-svn: 152386
2012-03-09 05:26:55 +00:00
Nick Kledzik
1a6615dc88
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.
llvm-svn: 152269
2012-03-08 00:18:30 +00:00
Nick Kledzik
6bc04c6904
Add support for SharedLibraryAtoms (proxy atoms for exported symbols from a
...
shared library) and AbsoluteAtoms (proxy atoms for absolute address (e.g. ROM)).
Redesign weak importing as can-be-null-at-runtime and can-be-null-at-build-time.
Add lots of test cases for all the above.
llvm-svn: 151204
2012-02-22 21:56:59 +00:00
Nick Kledzik
af18a2b29f
use llvm::DenseMap instead of std::map
...
llvm-svn: 150547
2012-02-15 00:50:07 +00:00
Nick Kledzik
49d6cc8457
(no commit message)
...
llvm-svn: 150539
2012-02-15 00:38:09 +00:00
Nick Kledzik
23384e84af
Add support for UndefinedAtom in yaml and native format. Add test cases with undefined atoms
...
llvm-svn: 149962
2012-02-07 02:59:54 +00:00
Michael J. Spencer
7aba8957c1
Cleanup system_error extensions.
...
llvm-svn: 149432
2012-01-31 21:47:13 +00:00
Michael J. Spencer
73e3e3c7b9
NULL requires including cstddef. Just use 0.
...
llvm-svn: 149425
2012-01-31 21:45:26 +00:00
Nick Kledzik
55fd6beb00
First chunk of native object file reader/writer. The lld-core tool now reads YAML file, links, writes that out as native object format, then reads that native file, then writes the YAML to stdout. Thus the test suite tests both YAML reading/writing as well as native object file reading/writing.
...
llvm-svn: 148256
2012-01-16 22:03:44 +00:00
Nick Kledzik
f4fb2c5ac8
A couple of big refactorings: 1) Move most attributes of Atom down to DefinedAtom, so only atoms representing definitions need to implement them. 2) Remove definitionTentative, definitionWeak, mergeDuplicates, and autoHide. Replace with merge and interposable attributes. 3) Make all methods on Atom be virtual so that future object file readers can lazily generated attributes
...
llvm-svn: 147903
2012-01-11 01:06:19 +00:00
Nick Kledzik
bfedfc171d
add initial support for coalescing by content (c-strings) with test case
...
llvm-svn: 147799
2012-01-09 20:18:15 +00:00
Nick Kledzik
7735a7d1a0
Support more Atom attributes. Add more test cases to lld-core
...
llvm-svn: 147571
2012-01-04 23:58:17 +00:00
Nick Kledzik
38eec3d931
Add more merging/coalescing test cases and make core linking work for them
...
llvm-svn: 147130
2011-12-22 02:38:01 +00:00
Nick Kledzik
f46669c828
Cleaned up Atom attribues some more. Added lots of doxygen comments
...
llvm-svn: 147105
2011-12-21 23:29:36 +00:00
Nick Kledzik
f96d0ade79
Refactor and comment Atom attributes. Replace combine() with internalName() and mergeDuplicates()
...
llvm-svn: 146958
2011-12-20 02:18:44 +00:00
Nick Kledzik
070e1a7643
add parseObjectTextFileOrSTDIN() utility
...
llvm-svn: 146931
2011-12-20 00:07:11 +00:00
Michael J. Spencer
773a8fb6ab
Initial commit. Code by Nick Kledzik. Cleanups and build system by me.
...
llvm-svn: 146844
2011-12-18 08:27:59 +00:00