Sid Manning
e3612f0f21
Fix incorrect setting of EI_DATA
...
llvm-svn: 165310
2012-10-05 14:06:24 +00:00
Hemant Kulkarni
8bd276120f
Added missing break in StockSectionChunk constructor.
...
Removed architecture dependent .sbss section creation.
Updated test case to show the change in section types and removal of a sbss section.
llvm-svn: 165181
2012-10-03 23:27:33 +00:00
Sid Manning
05c82a42dd
* Return correct size and alignment for common symbols.
...
llvm-svn: 165170
2012-10-03 21:46:48 +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
Sid Manning
e861d43f65
This change:
...
* Updates ReaderELF.cpp contentType method to match ELF.h's logic and now handle
typeData
* Add -arch to ldd-core testdriver
* Add testcase to check typeData
* Update others to stay in sync with this change.
llvm-svn: 164976
2012-10-01 23:23:05 +00:00
Michael J. Spencer
e2fb6c73f3
Fix -Wcovered-switch-default warning.
...
llvm-svn: 164846
2012-09-28 21:07:58 +00:00
Sid Manning
d3a7e7e164
Add case for typeConstant in SectionChunk
...
llvm-svn: 164732
2012-09-26 22:46:17 +00:00
Sid Manning
dd11020739
This patch makes use of recently added relocation reference data. The bulk
...
of this is derived from the Mach-O writer. Reviewed by: Nick Kledzik.
* Adds loop to SectionChunk::write traverse references calling the
writer's fixup handler, applyFixup.
* Adds method, ELFWriter::buildAtomToAddressMap to that creates a
mapping from an atom to its runtime address.
* Adds method, ELFWriter::addressOfAtom to return the runtime address
of the atom.
llvm-svn: 164618
2012-09-25 18:22:09 +00:00
Sid Manning
8caf4de31f
Add ELFReference class - parse relocations needed by that class and update DefinedAtom to use the class. Tweak coding style. Add testcase to check relocations. Change was signed-off-by: Michael Spencer
...
llvm-svn: 164027
2012-09-17 12:49:38 +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
Michael J. Spencer
69ed53ab5f
Fix warnings.
...
llvm-svn: 163573
2012-09-10 23:46:58 +00:00
Nick Kledzik
7243b89459
PR13467: Fix mach-o writer to handle case of zero stubs. Renumber TestingHelpers kind values
...
llvm-svn: 160982
2012-07-30 20:10:46 +00:00
Sid Manning
429a4bc172
Fix warning from -Wshadow. Report errors back to caller rather than calling
...
llvm::report_fatal_error.
llvm-svn: 160864
2012-07-27 14:52:18 +00:00
Sid Manning
ad58efd69a
Add a default constructor/destructor for ReaderOptionsPECOFF
...
llvm-svn: 160740
2012-07-25 17:16:46 +00:00
Sid Manning
1a60141f99
Implement the ELF reader. The original implementation was by Hemant Kulkarni
...
with subsequent changes to use lower level interfaces done by me.
llvm-svn: 160732
2012-07-25 16:27:21 +00:00
Marshall Clow
f33f0bbdcf
Minor edits to match style guidelines. No functionality change
...
llvm-svn: 160370
2012-07-17 16:18:04 +00:00
Michael J. Spencer
efcf099db5
Unused var warning.
...
llvm-svn: 158944
2012-06-21 22:41:46 +00:00
Michael J. Spencer
aedfa6a36b
Fix MSVC compat. MSVC doesn't have bzero.
...
Although the code is not valid to begin with. It is trying to do a raw memory
copy of a non standard-layout type. nameoffset is not guaranteed to directly
follow cmdsize.
This should be properly fixed.
llvm-svn: 158612
2012-06-17 01:18:44 +00:00
Nick Kledzik
7145cf6846
Add 'invalid' as a Reference Kind so that unknown/invalid kind strings can return that fact to the caller for use in constructing an error message, rather that triggering an assertion.
...
llvm-svn: 158547
2012-06-15 21:26:18 +00:00
Nick Kledzik
21f5d4d629
remove return statements after llvm_unreachable() as the compiler no longer warns abot missing return values
...
llvm-svn: 158544
2012-06-15 21:04:32 +00:00
Nick Kledzik
751eb3d2b3
use llvm_unreachable() instead of assert(0) for invalid enum values in switch statements
...
llvm-svn: 158542
2012-06-15 20:37:24 +00:00
Nick Kledzik
d6a27324f9
Use ADT/StringSwitch
...
llvm-svn: 158541
2012-06-15 20:29:27 +00:00
Nick Kledzik
c890ae41e2
flesh out mach-o Reference Kinds
...
llvm-svn: 158375
2012-06-12 23:01:30 +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
5fb2e4dabe
put the public function createReaderPECOFF() in the lld namespace and everything else in is own namespace
...
llvm-svn: 158135
2012-06-07 02:23:48 +00:00
Nick Kledzik
98211f6d19
fix warnings found after cranking up warnings
...
llvm-svn: 158134
2012-06-07 01:53:39 +00:00
Nick Kledzik
40b8655082
abstract load commands to that WriterMachO can write 64-bit and 32-bit mach-o files
...
llvm-svn: 158133
2012-06-07 01:45:39 +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
Nick Kledzik
a3c24f447f
remove completed items
...
llvm-svn: 156143
2012-05-04 01:14:02 +00:00
Nick Kledzik
3011259a85
Rework how YAMLReader is layered on top of YAMLParser. Turn hand written
...
recursive descent functions into one table driven parser. Add proper
error recovery and reporting. Add lots of test cases with semantics errors
and verify error messages.
llvm-svn: 156136
2012-05-03 23:55:34 +00:00
Michael J. Spencer
440b26749c
Address review comments from Roman Divacky.
...
llvm-svn: 156130
2012-05-03 23:36:39 +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
Michael J. Spencer
63d320064d
Remove whitespace.
...
llvm-svn: 155846
2012-04-30 21:19:44 +00:00
Evandro Menezes
f48d80161d
Fix minor warnings and simplify code.
...
llvm-svn: 155652
2012-04-26 19:20:11 +00:00
Jay Foad
4d5e6cf906
Fix errors when building with GCC 4.6.1 -std=c++0x, which requires
...
"friend class Foo;" instead of just friend Foo;".
llvm-svn: 155625
2012-04-26 07:37:08 +00:00
Michael J. Spencer
34fbcb4cba
MSVC fixes:
...
* MSVC does not yet support initializer lists and uniform initialization.
* MSVC does not support flexible array members (And neither does C++).
The Mach-O writer test still fails with this, but it all compiles and
all other tests pass.
llvm-svn: 155215
2012-04-20 18:35:18 +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
166b090a46
Audit uses of StringRef::getAsInteger.
...
llvm-svn: 152565
2012-03-12 18:13:36 +00:00
Michael J. Spencer
e753cbc685
Fix MSVC incompatibilities.
...
llvm-svn: 152389
2012-03-09 05:27:43 +00:00
Michael J. Spencer
b5ef4df359
StringRef is not null terminated.
...
llvm-svn: 152388
2012-03-09 05:27:20 +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
8c36f458fa
&vectorval[0] is UB when vectorval.size() == 0.
...
llvm-svn: 149430
2012-01-31 21:46:41 +00:00
Michael J. Spencer
4e45ebb92c
Fix use after free.
...
llvm-svn: 149429
2012-01-31 21:46:29 +00:00
Michael J. Spencer
846fe662ba
If cont.size() is 0, the expression &_contentPool[result] has undefined
...
behaivior because it indexes past the end of _contentPool.
llvm-svn: 149427
2012-01-31 21:46:05 +00:00
Michael J. Spencer
b2bd733593
Flexible array members are not in C++03, and MSVC doesn't support them.
...
llvm-svn: 149426
2012-01-31 21:45:53 +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