Commit Graph

472 Commits

Author SHA1 Message Date
Rafael Espindola aefd5c1617 Create ObjectFile with the correct endian and word size.
The writer is still hard coded to 64 bits le, but with this we can test for
invalid ELF files.

llvm-svn: 243993
2015-08-04 15:45:54 +00:00
Rafael Espindola e0a5c09a5c Use make_unique. NFC.
llvm-svn: 243988
2015-08-04 15:06:36 +00:00
Rafael Espindola 2ffdd4d0e5 The SymbolTable doesn't need to be a template.
It was already using just code that is common to all object files.

llvm-svn: 243985
2015-08-04 14:29:01 +00:00
Rafael Espindola 602592a048 Remove a silly return.
llvm-svn: 243983
2015-08-04 14:08:11 +00:00
Rafael Espindola 30318518a5 This function never returns null, don't check it.
llvm-svn: 243982
2015-08-04 14:00:56 +00:00
Rafael Espindola b89951457d Remove SymbolTable::getChunks.
When we were using a std::sort over all the chunks we needed to put them in a
single storage.

Now that we just iterate over them and use a map to find the output section,
we can avoid allocating the temporary storage.

llvm-svn: 243980
2015-08-04 13:39:30 +00:00
Michael J. Spencer 44fc1c0a73 [ELF2] Templatize addChunk and handle section flags.
llvm-svn: 243579
2015-07-29 22:14:50 +00:00
Rui Ueyama b4731a5847 ELF2: Use DenseMap instead of std::map for a symbol table.
We use DenseMap for COFF too.

llvm-svn: 243534
2015-07-29 16:30:40 +00:00
Michael J. Spencer 5a6f5f178e [ELF2] Emit correct section types.
llvm-svn: 243509
2015-07-29 00:52:17 +00:00
Michael J. Spencer 8039dae26d [ELF2] Emit section table.
llvm-svn: 243506
2015-07-29 00:30:10 +00:00
Michael J. Spencer cdae0a4e2d [ELF2] Devirtualize SymbolBody.
llvm-svn: 243496
2015-07-28 22:58:25 +00:00
Rui Ueyama e44524de65 Use SmallDenseMap instead of std::map where we don't care about order of keys.
llvm-svn: 243358
2015-07-28 00:17:25 +00:00
Rui Ueyama fdbbcdad87 ELF2: Inline very small functions.
llvm-svn: 243323
2015-07-27 20:39:04 +00:00
Rui Ueyama a7ccb2926f ELF2: Devirtualize SymbolBody::compare. NFC.
This is to make it consistent with COFF.

llvm-svn: 243321
2015-07-27 20:39:01 +00:00
Rui Ueyama 06d7bd2e42 ELF2: Avoid calling std::sort to make output deterministic.
llvm-svn: 243232
2015-07-26 00:50:15 +00:00
Rui Ueyama 179cd7b82a ELF2: Remove dead code.
llvm-svn: 243231
2015-07-26 00:50:13 +00:00
Michael J. Spencer 84487f1174 [ELF2] Add a new ELF linker based on the new PE/COFF linker.
Differential Revision: http://reviews.llvm.org/D11188

llvm-svn: 243161
2015-07-24 21:03:07 +00:00
Michael J. Spencer bae540e945 Revert ELF port. Posting to mailing list.
llvm-svn: 242118
2015-07-14 04:49:48 +00:00
Michael J. Spencer 50ed5308d1 Fix warnings.
llvm-svn: 242098
2015-07-14 01:02:37 +00:00
Michael J. Spencer f754b1fe12 Put explicit template instantiations in the correct namespace.
llvm-svn: 242093
2015-07-14 00:22:00 +00:00
Michael J. Spencer 64661cdb4c Remove commented out code.
llvm-svn: 242092
2015-07-14 00:11:38 +00:00
Michael J. Spencer 8a4145411f Initial ELF port.
This is a direct port of the new PE/COFF linker to ELF.

It can take a single object file and generate a valid executable that executes at the first byte in the text section.

llvm-svn: 242088
2015-07-13 23:48:06 +00:00