Commit Graph

4092 Commits

Author SHA1 Message Date
Rui Ueyama 1c8092c915 ELF2: Tidy up Options.td.
Fix indentation and sort options alphabetically.

llvm-svn: 248969
2015-10-01 00:33:02 +00:00
Rui Ueyama 5d8ef2cbd8 ELF2: Ignore some command line argument that clang passes to the linker.
llvm-svn: 248967
2015-10-01 00:24:54 +00:00
Rui Ueyama 819f7127c0 ELF2: Move tests for linker script from basic.s to linkerscript.s.
llvm-svn: 248961
2015-09-30 23:15:35 +00:00
Rui Ueyama 2dfd74f758 ELF2: Add DT_REL{,A}ENT and DT_SYMENT.
According to the ELF specification, these dynamic array entries are mandatory.

http://reviews.llvm.org/D13303

llvm-svn: 248952
2015-09-30 21:57:53 +00:00
Davide Italiano c02fcafef6 [ELF2] Expand test comment a little bit, use reloc name as section name.
llvm-svn: 248930
2015-09-30 19:44:30 +00:00
Rui Ueyama 7971152589 ELF2: Do not set default values that will always be overwritten.
These member variables are overwritten unconditionally by Driver,
so setting default values would be confusing.

llvm-svn: 248922
2015-09-30 17:26:13 +00:00
Rui Ueyama f7c5fbb1ca ELF2: Create LinkerScript.cpp and move code from DriverUtils to there.
llvm-svn: 248920
2015-09-30 17:23:26 +00:00
Rui Ueyama bf506b7d48 ELF2: LinkerScript: Handle quoted tokens.
llvm-svn: 248919
2015-09-30 17:15:29 +00:00
Rui Ueyama f5c4aca98f ELF2: Add basic linker script support.
This linker script parser and evaluator is powerful enough to read
Linux's libc.so, which is (despite its name) a linker script that
contains OUTPUT_FORMAT, GROUP and AS_NEEDED directives.

The parser implemented in this patch is a recursive-descendent one.
It does *not* construct an AST but consumes directives in place and
sets the results to Symtab object, like what Driver is doing.
This should be very fast since less objects are allocated, and
this is also more readable.

http://reviews.llvm.org/D13232

llvm-svn: 248918
2015-09-30 17:06:09 +00:00
Rafael Espindola 3c412e14cc Expand a comment a bit.
llvm-svn: 248894
2015-09-30 12:30:58 +00:00
George Rimar 431f94c8e0 test commit
llvm-svn: 248890
2015-09-30 11:42:29 +00:00
Igor Kudrin f03d2b4d1c [ELF2] Simplify buildSysrootedPath()
Reviewed by: rafael

llvm-svn: 248885
2015-09-30 10:39:37 +00:00
Rui Ueyama 82d705e6d9 Remove unused declaration and forward declaration.
llvm-svn: 248877
2015-09-30 03:31:05 +00:00
Rui Ueyama d0e5aebf3a Expand `auto` whose real type is not obvious from context.
llvm-svn: 248876
2015-09-30 02:42:27 +00:00
Rui Ueyama 90b3daaa5c Remove `else` after `return`.
llvm-svn: 248875
2015-09-30 02:37:51 +00:00
Rui Ueyama 294b136db4 Remove `explicit` from constructors that take more than one parameter.
llvm-svn: 248873
2015-09-30 02:06:17 +00:00
Rui Ueyama 5ba3ac4f10 Simplify switch statements. NFC.
llvm-svn: 248871
2015-09-30 01:40:08 +00:00
Rui Ueyama c55733e79c ELF2: Advance the buffer pointers right after we use them.
So that it is clear that we are incrementing the pointers for sure. NFC.

llvm-svn: 248868
2015-09-30 00:54:29 +00:00
Rui Ueyama b189b5c535 Make template instantiation code a bit shorter. NFC.
llvm-svn: 248866
2015-09-30 00:43:22 +00:00
Rui Ueyama 8ddfa812af ELF2: Split SymbolTableSection<ELFT>::writeTo into two smaller functions.
Also added brief comments.

llvm-svn: 248864
2015-09-30 00:32:10 +00:00
Rui Ueyama e3fbc89c44 ELF2: Do not use host pointer size to calculate x86_64 relocation addresses.
Previous code had a potential portability issue because intptr_t is
not guaranteed to be 64 bit.

llvm-svn: 248856
2015-09-29 23:25:21 +00:00
Rafael Espindola 9a0db7cbef Fix typo.
llvm-svn: 248855
2015-09-29 23:23:53 +00:00
Rafael Espindola 3ef3a4c9ff Start adding support for static programs using dynamic libraries.
This is just enough for a hello world using a dynamic glibc.

llvm-svn: 248854
2015-09-29 23:22:16 +00:00
Rafael Espindola 6a78fd5f41 This reverts commit r248845 and r248848.
They broke elf2/basic-mips.s.

Revert "[elf2] Sort output sections."
Revert "[elf2] Fix build."

llvm-svn: 248851
2015-09-29 23:19:25 +00:00
Rui Ueyama 85bbe0c46b Remove the dependency to 'test' command.
llvm-svn: 248849
2015-09-29 23:13:40 +00:00
Michael J. Spencer a0abcfd8e7 [elf2] Fix build.
llvm-svn: 248848
2015-09-29 23:12:50 +00:00
Michael J. Spencer fe07bd67fd [elf2] Sort output sections.
Sort by:
ALLOC
ALLOC && NOBITS
ALLOC & EXEC
ALLOC & EXEC && NOBITS
ALLOC & WRITE
ALLOC & WRITE && NOBITS
<nothing> (ignoring NOBITS)

The dynamic section is finalized early because it adds strings to the dynamic string table, which comes before the dynamic table.

llvm-svn: 248845
2015-09-29 23:05:40 +00:00
Rui Ueyama 1500a90093 ELF2: Do not create ArrayRefs and use const arrays instead. NFC.
llvm-svn: 248844
2015-09-29 23:00:47 +00:00
Rui Ueyama 511631975d ELF2: Make default-output.s test idempotent.
This test failed if being run more than once because of the
remaining file of the last run.

llvm-svn: 248843
2015-09-29 22:57:22 +00:00
Rui Ueyama a7e628ff10 ELF2: Unbreak buildbot.
Subshell didn't work on Windows.

llvm-svn: 248840
2015-09-29 22:46:52 +00:00
Rui Ueyama 4993d0eb51 ELF2: Sort Config member variables. NFC.
llvm-svn: 248838
2015-09-29 22:33:21 +00:00
Rui Ueyama d7c417c03e ELF2: Assign bool values directly. NFC.
llvm-svn: 248837
2015-09-29 22:33:18 +00:00
Rui Ueyama 4eed0114c5 ELF2: Use 'a.out' as default output file name.
llvm-svn: 248831
2015-09-29 21:49:40 +00:00
Rafael Espindola 2d73648667 Update test to use invalid elf file in archives.
The code in driver is about to change so that the invalid files would no
longer be seen as ELF.

This makes sure that the error path will remain tested.

llvm-svn: 248820
2015-09-29 18:44:18 +00:00
Rui Ueyama 9d4c6d771b [ELF2] Implemented --entry flag.
Patch from George Rimar!

llvm-svn: 248806
2015-09-29 16:40:13 +00:00
Rafael Espindola 8acb95c7ab Add support for R_386_GOT32.
llvm-svn: 248799
2015-09-29 14:42:37 +00:00
Rafael Espindola be901e2dbc Don't apply a relocation if we create a dynamic reloc.
With RELA that is just wasteful, with REL the relocation gets applied
twice.

llvm-svn: 248795
2015-09-29 13:51:43 +00:00
Rafael Espindola 6d7fcdb518 Add R_386_GOTPC support.
llvm-svn: 248793
2015-09-29 13:36:32 +00:00
Simon Atanasyan 49829a1bfe [ELF2] Add initial MIPS support
Besides a trivial MIPS support the patch introduces new TargetInfo class
member getDefaultEntry() to override default name of the entry symbol.
MIPS uses __start for that.

Differential Revision:  http://reviews.llvm.org/D13227

llvm-svn: 248779
2015-09-29 05:34:03 +00:00
Cameron Esfahani e211e204da NFC: Fix spelling error in comment.
llvm-svn: 248768
2015-09-29 00:21:38 +00:00
Rafael Espindola 2732235508 Try to fix gcc warning
llvm-svn: 248749
2015-09-28 22:12:54 +00:00
Rafael Espindola 5f19f1224c Delete dead code.
llvm-svn: 248747
2015-09-28 22:07:52 +00:00
Lang Hames 9a4c94ec5a [lld][MachO] Fix a think-o to get the twolevel/dynamic_lookup test passing.
llvm-svn: 248736
2015-09-28 20:52:21 +00:00
Rafael Espindola 4b2ca85c1a Implement --allow-multiple-definition.
Patch by George Rimar!

llvm-svn: 248733
2015-09-28 20:30:11 +00:00
Lang Hames 5c692009bc [lld][MachO] Initial implementation of -flat_namespace and -undefined.
This is a basic initial implementation of the -flat_namespace and
-undefined options for LLD-darwin. It ignores several subtlties,
but the result is close enough that we can now link LLVM (but not
clang) on Darwin and pass all regression tests.

llvm-svn: 248732
2015-09-28 20:25:14 +00:00
Rafael Espindola 085a8f5ea7 Don't include fully resolved relocations in the dynamic relocation table.
llvm-svn: 248731
2015-09-28 20:18:40 +00:00
Rafael Espindola 46e01554b1 Add support for got/ptl referring to symbols defined in .o files.
llvm-svn: 248730
2015-09-28 19:48:34 +00:00
Rafael Espindola dfc7200b18 Add support for local absolute symbols.
llvm-svn: 248726
2015-09-28 18:29:47 +00:00
Rui Ueyama c5e22d906b ELF2: Include file names in error messages.
llvm-svn: 248724
2015-09-28 18:20:41 +00:00
Igor Kudrin 1309fc0378 [ELF2] Add --sysroot command line switch
Reviewers: rafael, ruiu

Subscribers: llvm-commits

Projects: #lld

Differential Revision: http://reviews.llvm.org/D13209

llvm-svn: 248715
2015-09-28 15:01:59 +00:00