Rui Ueyama
eaadec3a39
[lld] Document about how to enable debug output.
...
llvm-svn: 181640
2013-05-10 22:19:28 +00:00
Shankar Easwaran
bd525a3f63
[lld][ELF] set ordinals for mergeAtoms and fix testcase
...
llvm-svn: 181622
2013-05-10 18:52:29 +00:00
Shankar Easwaran
3c5d2c8a24
[lld][LayoutPass] This commit fixes a problem in the
...
Layoutpass by ordering atoms if they appear in the override
list first and then looking at the way of ordering atoms in
the default way.
The fix also fixes issues with the sizes of the sections,
that appear in the output properly too.
The commit also adds a testcase(orderatoms-by-override.test)
to test it and fixes all the other relevant testcases.
llvm-svn: 181605
2013-05-10 16:44:02 +00:00
Rui Ueyama
eb6b6e4857
[lld] Fix broken test. -layout-pass option does not exist.
...
Also shuffle the atoms so that it can verify the layout pass
actually changed the layout.
llvm-svn: 181573
2013-05-10 00:50:33 +00:00
Rui Ueyama
4689326d4c
[lld] Fix wrong comment.
...
llvm-svn: 181547
2013-05-09 21:14:02 +00:00
Rui Ueyama
90b3b92a8b
[lld] Use range based for loop instead of explicit iterators (no functionality change)
...
llvm-svn: 181503
2013-05-09 04:00:44 +00:00
Rui Ueyama
60f5f30687
[lld] Add comments to InputFiles::searchLibraries() arguments.
...
llvm-svn: 181492
2013-05-08 23:54:10 +00:00
Rui Ueyama
980e52d7ae
[lld][Core] Fix latch synchronization bug.
...
We need to acquire a lock before signal a condition.
Otherwise threads waiting on a condition variable can
miss a signal.
Consider two threads: Thread A executing dec() and thread
B executing sync(). The initial value of _count is 1. If
these two threads are interleaved in the following order,
thread B misses the signal sent by thread A, because at the
time thread A sends a signal, B is not waiting for it.
Thread A | Thread B
| std::unique_lock<std::mutex> lock(_condMut);
| while (!(_count == 0)) {
if (--_count == 0) |
_cond_notify_all() |
| _cond.wait();
| }
Note that "wait(lock, pred)" is equivalent to "while(!pred())
wait(lock)", so I expanded it in the above example.
Reviewers: Bigcheese
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D764
llvm-svn: 181484
2013-05-08 23:29:24 +00:00
Rui Ueyama
ec504cfffd
[lld] Add "explicit" to constructors where appropriate.
...
Summary:
Add the explicit keyword to one-parameter
constructors to prevent unintended type conversions.
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D765
llvm-svn: 181483
2013-05-08 23:20:53 +00:00
Nick Kledzik
80d8308b57
Use anonymous namespace for local classes. Patch by Rui Ueyama
...
llvm-svn: 181473
2013-05-08 21:34:11 +00:00
Shankar Easwaran
e796006333
[lld][ELF] fix build failure
...
llvm-svn: 181325
2013-05-07 15:27:02 +00:00
Shankar Easwaran
790ede43de
[lld][ELF] split ELF reader into multiple functions for readability (no change in functionality)
...
llvm-svn: 181288
2013-05-07 04:58:09 +00:00
Michael J. Spencer
75ed350132
[ELF] Initialize readers and writers on creation.
...
This makes the target handler a constructor argument because the constructor of
OutputELFWriter relies on it being initialized.
llvm-svn: 181280
2013-05-07 00:28:07 +00:00
Michael J. Spencer
b5fb0dee0c
[Core] Properly stop the ThreadPoolExecutor and use the ConcRT memory allocator.
...
llvm-svn: 181279
2013-05-07 00:27:40 +00:00
Shankar Easwaran
c8858b3469
[lld]remove lld-core
...
llvm-svn: 181244
2013-05-06 20:24:39 +00:00
Tim Northover
d11e5bc03c
[lld][ELF] fix header comment typos
...
llvm-svn: 181188
2013-05-06 08:31:58 +00:00
Shankar Easwaran
6e1f5b7d1a
[lld][ELF] reduce the number of symbols emitted in the symbol table
...
llvm-svn: 180872
2013-05-01 19:36:38 +00:00
Shankar Easwaran
02078464e1
[lld][ELF] continue on finding a section with no symbols, tests already present
...
llvm-svn: 180769
2013-04-30 03:14:01 +00:00
Shankar Easwaran
cc06891c42
[lld][ELF] (no testable functionality change) resize the number of entries in the string table for static linking
...
llvm-svn: 180692
2013-04-29 04:10:42 +00:00
Shankar Easwaran
d846d9852e
[lld][ELF] (no testable functionality change) resize the number of entries in the string table for static linking
...
llvm-svn: 180691
2013-04-29 04:10:11 +00:00
Shankar Easwaran
45a5f93517
[lld][LayoutPass] initialize the number of entries for the densehash (no functionality change)
...
llvm-svn: 180690
2013-04-29 03:27:57 +00:00
Michael J. Spencer
9d70cef481
[Core] Allow weak symbols in shared library when linking.
...
Patch by Rui Ueyama.
llvm-svn: 180209
2013-04-24 19:00:26 +00:00
Andy Gibbs
93383381d7
Distinguish between unsupported and unrecognised flavours.
...
Suggested by Nick Kledzik in reference to r179590.
llvm-svn: 179617
2013-04-16 19:24:13 +00:00
Andy Gibbs
bab932b850
Moved llvm_unreachable out of switch blocks to avoid the "control reaches end of non-void function" warning.
...
llvm-svn: 179590
2013-04-16 11:52:34 +00:00
Michael J. Spencer
1eb3b89d92
[Core] Add parallel infrastructure to lld.
...
Uses ConcRT and PPL on Windows.
llvm-svn: 179397
2013-04-12 18:40:39 +00:00
Nico Rieck
bdfd4eb223
Replace elf-dump with llvm-readobj in lld tests
...
llvm-svn: 179364
2013-04-12 04:29:01 +00:00
Shankar Easwaran
bba9fe8495
[test] missing underscore while checking for test output
...
llvm-svn: 179264
2013-04-11 04:20:21 +00:00
Shankar Easwaran
4cb24b38f6
[test] fix failing test, the test was not accounting for - in the path
...
llvm-svn: 179260
2013-04-11 04:08:11 +00:00
Shankar Easwaran
eeee23e60a
This adds functionality for undefined atoms from dynamic libraries to be added
...
to the list of undefined atoms.
The processing of undefined atoms from dynamic libraries is controlled by
use-shlib-undefines command line option.
This patch also adds additional command line arguments to allow/disallow
unresolved symbols from shared libraries and mimics GNU ld behavior.
llvm-svn: 179257
2013-04-11 02:56:30 +00:00
Michael J. Spencer
d4eb47c110
Add VTune as an optional external dependency and add task tracking.
...
llvm-svn: 178940
2013-04-06 00:56:40 +00:00
Michael J. Spencer
e6d5609de4
Revert "Correctly pass ownership of MemoryBuffers."
...
llvm-svn: 178918
2013-04-05 22:04:44 +00:00
Michael J. Spencer
ce1e53e19c
Correctly pass ownership of MemoryBuffers.
...
llvm-svn: 178914
2013-04-05 21:08:30 +00:00
Michael J. Spencer
096ea03f31
Fix uninitialized variables. Found by ubsan.
...
llvm-svn: 178913
2013-04-05 21:07:44 +00:00
Shankar Easwaran
f4a5e2f439
[ELF][test] add dynamic library search
...
llvm-svn: 178840
2013-04-05 04:34:57 +00:00
Shankar Easwaran
a4323a5cca
This fixes a SIGSEGV failure in ReaderArchive while trying to trace what
...
InputFile is being pulled from the Archive library to resolve a symbol.
The buffer which was being used was already being handed over to the
MemoryBuffer object and was being accessed after the hand over.
Moving it before the buffer is handed over.
llvm-svn: 178838
2013-04-05 03:50:15 +00:00
Shankar Easwaran
831b4a0503
[test] remove printing the file to stdout
...
llvm-svn: 178817
2013-04-04 23:53:46 +00:00
Shankar Easwaran
d953d66ee9
[ELF] fix atom order
...
llvm-svn: 178815
2013-04-04 23:51:36 +00:00
Michael J. Spencer
dfe85483d5
[Driver] Fix symlinked universal driver behavior and add a test.
...
llvm-svn: 178798
2013-04-04 22:04:16 +00:00
Nick Kledzik
563d9dc1b2
temp change to test case to debug buildbot failure
...
llvm-svn: 178788
2013-04-04 20:34:37 +00:00
Nick Kledzik
f4fa8c0a75
fix DEBUG_WITH_TYPE to build without warnings in non-debug builds
...
llvm-svn: 178787
2013-04-04 20:32:18 +00:00
Michael J. Spencer
3ab4db67f7
Fix MSVC build.
...
llvm-svn: 178781
2013-04-04 19:45:34 +00:00
Nick Kledzik
be7b005d83
fix darwin driver to validate command line options
...
llvm-svn: 178778
2013-04-04 19:26:14 +00:00
Nick Kledzik
9a632dbe0c
fix command line option to use -o
...
llvm-svn: 178777
2013-04-04 19:17:58 +00:00
Nick Kledzik
c314b46e71
This is my Driver refactoring patch.
...
The major changes are:
1) LinkerOptions has been merged into TargetInfo
2) LinkerInvocation has been merged into Driver
3) Drivers no longer convert arguments into an intermediate (core) argument
list, but instead create a TargetInfo object and call setter methods on
it. This is only how in-process linking would work. That is, you can
programmatically set up a TargetInfo object which controls the linking.
4) Lots of tweaks to test suite to work with driver changes
5) Add the DarwinDriver
6) I heavily doxygen commented TargetInfo.h
Things to do after this patch is committed:
a) Consider renaming TargetInfo, given its new roll.
b) Consider pulling the list of input files out of TargetInfo. This will
enable in-process clients to create one TargetInfo the re-use it with
different input file lists.
c) Work out a way for Drivers to format the warnings and error done in
core linking.
llvm-svn: 178776
2013-04-04 18:59:24 +00:00
Rafael Espindola
26cf0b5130
Update for API change for handling mips64el.
...
llvm-svn: 178695
2013-04-03 21:03:19 +00:00
Rafael Espindola
13de1566d0
Update the lld testsuite for the llvm-readobj format change.
...
llvm-svn: 178693
2013-04-03 20:53:45 +00:00
Shankar Easwaran
34353270a0
[ELF][Hexagon] fix few relocations and add test
...
llvm-svn: 178495
2013-04-01 20:20:11 +00:00
Shankar Easwaran
1d9e531856
[ELF][Hexagon] Create .got.plt entries with the appropriate alignment
...
llvm-svn: 178467
2013-04-01 15:14:34 +00:00
Shankar Easwaran
cbe06ca340
[ELF] Set the symbol type for undefined atoms properly
...
llvm-svn: 178466
2013-04-01 15:12:54 +00:00
Shankar Easwaran
bb9d4a5ca0
[ELF] Add dynamic hash table and get simple dynamic libraries working with Hexagon
...
llvm-svn: 178323
2013-03-29 00:53:25 +00:00
Michael J. Spencer
8759beb424
[ELF] Cache contentType and permissions.
...
llvm-svn: 178269
2013-03-28 18:58:50 +00:00
Michael J. Spencer
1067ff61e6
[Driver] Don't open files multiple times.
...
llvm-svn: 178268
2013-03-28 18:58:35 +00:00
Shankar Easwaran
c3048de5ac
[ELF][Hexagon] remove duplicated code
...
llvm-svn: 178027
2013-03-26 15:06:52 +00:00
Shankar Easwaran
7404004a4c
[ELF][Hexagon] Fixing failing test on Bots, few symbol names are available only in debug builds, dont check the symbol names
...
llvm-svn: 177991
2013-03-26 04:01:26 +00:00
Shankar Easwaran
14bfcd3e0f
[ELF] no change in functionality, add functions to symbol table so that they can be overridden by derived classes
...
llvm-svn: 177990
2013-03-26 03:53:33 +00:00
Shankar Easwaran
499aa9e028
[ELF][Hexagon] add GOTREL/GOT relocations
...
llvm-svn: 177970
2013-03-26 02:20:56 +00:00
Shankar Easwaran
1af701ec6a
[ELF] order rela.dyn/rela.plt properly
...
llvm-svn: 177969
2013-03-26 02:20:08 +00:00
Shankar Easwaran
aec2165123
[ELF] fix dynamic symbol table entries and update tests
...
llvm-svn: 177875
2013-03-25 16:41:14 +00:00
Shankar Easwaran
71738cafe6
[ELF][Hexagon][test] check .got.plt order
...
llvm-svn: 177604
2013-03-20 23:39:43 +00:00
Shankar Easwaran
0fa1b3c86a
[X86_64][test] check that interp section is not emitted when building dynamic libraries
...
llvm-svn: 177603
2013-03-20 23:34:36 +00:00
Michael J. Spencer
67f25272f1
[SymbolTable][Perf] Use hash_combine instead of a custom hash, also use memcmp.
...
ArrayRef<uint8_t>::equals(); lowers to a byte compare loop :(.
TODO: Figure out if we are getting hash collisions, or just have a lot of equal
content. Also test if crypto hashing the content instead of full compare is
better.
llvm-svn: 177588
2013-03-20 22:18:22 +00:00
Michael J. Spencer
417c19923b
[ELF][Reader] Add debug message to print all inputs the linker actually read.
...
llvm-svn: 177564
2013-03-20 19:26:10 +00:00
Michael J. Spencer
da384eebe5
[ELF][Reader][Perf] Only do loookup once.
...
llvm-svn: 177563
2013-03-20 19:25:58 +00:00
Michael J. Spencer
602ffc13b8
[ELF][Reader] Refactor how relocations are read. Improves performance.
...
This changes from reading each relocation individually for each section to just
storing the range of relocations. It also counts the relocations to preallocate
the _references array.
llvm-svn: 177562
2013-03-20 19:25:47 +00:00
Michael J. Spencer
55a7070bea
[ELF][Reader] Remove static ordinal.
...
llvm-svn: 177561
2013-03-20 19:25:34 +00:00
Michael J. Spencer
9dc5489441
memcpy instead of copy_n. Faster than copy_n on MSVC :(.
...
llvm-svn: 177557
2013-03-20 18:58:07 +00:00
Michael J. Spencer
fa405277cb
Devirtualize Reference::kind.
...
Improves performance.
llvm-svn: 177556
2013-03-20 18:57:52 +00:00
Michael J. Spencer
0f3dd616bd
Devirtualize File::kind.
...
This is the standard way of implementing LLVM RTTI.
llvm-svn: 177555
2013-03-20 18:57:27 +00:00
Michael J. Spencer
6580d1f226
Set ordinals correctly.
...
This actually doesn't change behavior with the current LinkerInvocation, but
it's needed when you make reading parallel.
llvm-svn: 177554
2013-03-20 18:56:57 +00:00
Shankar Easwaran
452ba13271
[ELF][Hexagon] Add Hexagon dynamic relocations
...
llvm-svn: 177484
2013-03-20 05:10:02 +00:00
Shankar Easwaran
06a4039572
[ELF] Interp section is only needed in dynamic executables
...
llvm-svn: 177483
2013-03-20 05:06:40 +00:00
Shankar Easwaran
1e848e0edf
[ELF] Order .got.plt properly
...
llvm-svn: 177482
2013-03-20 04:52:08 +00:00
Andy Gibbs
1fb8ce4002
Fix "control reaches end of non-void function" compiling lld on gcc.
...
llvm-svn: 177424
2013-03-19 19:13:36 +00:00
Alexey Samsonov
2712b064d8
Add virtual destructors to fix -Wnon-virtual-dtor warnings
...
llvm-svn: 177392
2013-03-19 11:41:16 +00:00
Shankar Easwaran
8962feb915
[lld] remove trailing whitespace
...
llvm-svn: 177079
2013-03-14 16:09:49 +00:00
Shankar Easwaran
74fc23fa5d
[ELF][X86_64][Hexagon] order plt/got entries properly and fix test
...
llvm-svn: 176970
2013-03-13 20:30:11 +00:00
Shankar Easwaran
8c25685be7
[Pass][Layout] Add extra debugging information
...
llvm-svn: 176925
2013-03-13 04:05:38 +00:00
Michael J. Spencer
c4e45f855c
[ELF][Writer] Let std::vector handle allocating space instead of reserving tiny portions.
...
llvm-svn: 176916
2013-03-13 00:30:08 +00:00
Michael J. Spencer
1ecf890215
[Pass][Layout] Make algorithm not n^2.
...
This reduces the time spent in this function while linking ASTMatchersTests
from %43 to %2.4 of total link time.
llvm-svn: 176842
2013-03-12 00:10:00 +00:00
Shankar Easwaran
fc9d0a7d9b
[ELF] Set values for bss_start and end symbols properly, If there are two load segments with RW permissions, bss_start and end may get set inappropriate
...
llvm-svn: 176795
2013-03-11 01:38:22 +00:00
Michael J. Spencer
9b5e8da3b4
[Driver][GNU] Accept and ignore more options.
...
llvm-svn: 176749
2013-03-09 01:41:37 +00:00
Michael J. Spencer
52fdb8bf13
Fix (possible) MSVC miscompile in debug mode.
...
llvm-svn: 176748
2013-03-09 01:41:27 +00:00
Michael J. Spencer
2d224509af
[Writer][ELF] Use correct data types for sizes. Fixes integer overflow bug.
...
This only happens when the section header count is > 1024.
llvm-svn: 176747
2013-03-09 01:41:16 +00:00
Shankar Easwaran
b327810215
[ELF] Create baseclass for all ELF writers
...
llvm-svn: 176724
2013-03-08 21:42:51 +00:00
Shankar Easwaran
c44bc347cb
[ELF] Order weak symbols properly
...
llvm-svn: 176583
2013-03-06 21:59:27 +00:00
Shankar Easwaran
7d89b2b6a7
[ELF][Hexagon] fixing dynlib test
...
llvm-svn: 176503
2013-03-05 19:00:21 +00:00
Shankar Easwaran
b6ef6c5a52
[ELF][Hexagon] fixing test failure
...
llvm-svn: 176497
2013-03-05 18:39:16 +00:00
Dmitri Gribenko
e16bc92063
Fix -Wdocumentation warning: use a correct Doxygen comment marker
...
llvm-svn: 176494
2013-03-05 18:11:01 +00:00
Shankar Easwaran
49ae019997
[ELF] Set symbol type to STT_SECTION, so that objdump.bfd doesnot get confused when disassembling output
...
llvm-svn: 176489
2013-03-05 16:09:32 +00:00
Shankar Easwaran
3ff62ade38
[ELF] add dynamic library support
...
llvm-svn: 176483
2013-03-05 14:52:48 +00:00
Shankar Easwaran
bcb722a452
[ELF] Remove comment
...
llvm-svn: 176482
2013-03-05 14:45:59 +00:00
Shankar Easwaran
7b0ae11c82
[ELF] no functionality change, update dynamicTable functionality
...
llvm-svn: 176430
2013-03-04 02:21:16 +00:00
Shankar Easwaran
03a525d6fd
[lld][ELF] Add modified writer
...
llvm-svn: 176425
2013-03-03 22:10:57 +00:00
Shankar Easwaran
1993b0000c
[lld][ELF] rename to add new support in the ELF Writer
...
llvm-svn: 176424
2013-03-03 22:09:22 +00:00
Shankar Easwaran
62bba5ddfb
[ELF] rename Writer to ExecutableWriter
...
llvm-svn: 176416
2013-03-03 07:37:17 +00:00
Shankar Easwaran
1729e12358
[ELF][Hexagon] add initial changes to add GOT/PLT
...
llvm-svn: 176415
2013-03-03 07:34:56 +00:00
Shankar Easwaran
b0e356e223
move dynamic linking atoms to Atoms.h
...
llvm-svn: 176370
2013-03-01 19:33:42 +00:00
Michael J. Spencer
8c0526593a
[Writer][ELF][x86-64] Handle GOTPCREL relocations to SharedLibraryAtoms.
...
llvm-svn: 176324
2013-03-01 01:09:46 +00:00
Michael J. Spencer
3e00c5015f
[ELF][x86-64] Only emit a PLT entry for a PLT relocation if the target atom is a SharedLibraryAtom.
...
This seems to be what ld does, but I'm not sure how it works with symbol interposition.
With this hello-world with glibc dynamically linked works.
llvm-svn: 176310
2013-03-01 00:03:56 +00:00
Michael J. Spencer
a55e37f477
Add basic linker script parsing.
...
llvm-svn: 176309
2013-03-01 00:03:36 +00:00