Commit Graph

342 Commits

Author SHA1 Message Date
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
Shankar Easwaran da28895597 [ELF][Hexagon] add quickdata relocations
llvm-svn: 176298
2013-02-28 20:54:03 +00:00
Michael J. Spencer a26f71c9ed [ELF][x86-64] Separate static and dynamic GOT/PLT generation.
llvm-svn: 176294
2013-02-28 20:04:32 +00:00
Shankar Easwaran 4685069152 [ELF][tests] changes for test cases
llvm-svn: 176280
2013-02-28 18:38:20 +00:00
Shankar Easwaran 937aa19a4b [ELF] Set header flags to 0 by default
llvm-svn: 176279
2013-02-28 18:36:34 +00:00
Shankar Easwaran dac3873442 [ELF][Hexagon] change Header flags
llvm-svn: 176278
2013-02-28 18:35:27 +00:00
Shankar Easwaran 8a2d1990d8 [lld][ELF][Hexagon] add more relocations
llvm-svn: 176277
2013-02-28 18:29:23 +00:00
Shankar Easwaran d4ac74ffcc [lld][ELF] Order segments
llvm-svn: 176207
2013-02-27 20:24:47 +00:00
Michael J. Spencer 2e41976893 [test] Don't start elf-dump until lld-core is done writing the output.
llvm-svn: 176205
2013-02-27 20:01:43 +00:00
Shankar Easwaran c5eda3ad2b fixing build error properly according to comment from David
llvm-svn: 176169
2013-02-27 05:53:38 +00:00
Shankar Easwaran 4f4ed0acdf adding a return to fix compilation error from buildbot, build #75
llvm-svn: 176167
2013-02-27 05:33:27 +00:00
Shankar Easwaran 2ce6b43f40 fixing typo in header file
llvm-svn: 176162
2013-02-27 04:02:30 +00:00
Michael J. Spencer 2063679ec4 [ELF][Writer] Add dynamic relocation tables.
This adds separate PLT and dynamic relocation tables. It also fills in the dynamic table
entries for them.

llvm-svn: 176150
2013-02-27 01:30:27 +00:00
Michael J. Spencer 7f09a3d54e [Pass][Layout] Fix bug and add debug printing.
Fix a bug where if two atoms had the same index in the override map,
the compare would return false. It now goes to the next check when
they are equal.

No test because it currently can't be tested. An upcomming patch will test it.

llvm-svn: 176073
2013-02-26 01:35:30 +00:00
Michael J. Spencer f10c0a3aa0 [ELF][Writer] Fill in dynamic table entries.
llvm-svn: 176045
2013-02-25 20:03:09 +00:00
Shankar Easwaran 596b40871a [ELF][Hexagon] add _SDA_BASE_(absolute symbol pointing to start of quickdata)
llvm-svn: 175997
2013-02-24 16:02:24 +00:00
Shankar Easwaran 1b095842ec [ELF] Change functions to virtual, in ExecutableAtoms
llvm-svn: 175993
2013-02-24 15:11:55 +00:00
Shankar Easwaran 5f0afe84f5 [ELF]Change name of runtime files, so that targets can change runtime files that they own
llvm-svn: 175992
2013-02-24 14:54:02 +00:00
Shankar Easwaran db74ffbe72 [ELF][Hexagon]add typeZeroFillFast
llvm-svn: 175983
2013-02-24 03:09:10 +00:00
Michael J. Spencer 3407211b2f [ELF][Writer] Add hash table.
llvm-svn: 175972
2013-02-23 19:46:18 +00:00
Michael J. Spencer 13db19d64e [ELF][Writer] Add a PHDR program table entry for dynamic files.
llvm-svn: 175951
2013-02-23 03:58:06 +00:00
Michael J. Spencer 942dbcc209 [ELF][Writer] Add dynamic string and symbol table.
llvm-svn: 175941
2013-02-23 01:02:31 +00:00
Shankar Easwaran 8c55c01d2a sort quickdata for the hexagon target
llvm-svn: 175904
2013-02-22 18:01:08 +00:00
Shankar Easwaran 873c9ffba0 add changes for typeDataFast
llvm-svn: 175901
2013-02-22 17:18:53 +00:00
Michael J. Spencer e4c0e3712f [ELF][Writer] Add .interp section.
llvm-svn: 175657
2013-02-20 20:13:47 +00:00
Michael J. Spencer b71ce655a8 [ELF][Writer] Add dynamic table.
llvm-svn: 175654
2013-02-20 19:46:12 +00:00
Shankar Easwaran 8a1a4e7cf7 rename fixupAddend to relocAddend
llvm-svn: 175638
2013-02-20 17:42:00 +00:00
Shankar Easwaran 25832ede03 functionality to handle global atoms in Merge sections
llvm-svn: 175636
2013-02-20 17:38:37 +00:00
Michael J. Spencer 2139795dfa [Driver][GNULD] Lookup .so files and default to dynamic output.
llvm-svn: 175572
2013-02-19 23:05:36 +00:00
Michael J. Spencer cadb082e5a [ELF] Fix memory leak by deleting BumpPtr allocated objects.
llvm-svn: 175558
2013-02-19 21:04:30 +00:00
Chandler Carruth 21aaf2534d Switch a vector<pair<const T &, const U &>> to a vector<pair<const T *,
const U *>>. Even in C++11 it doesn't seem this is valid as vector's
emplace support requires move assignment, and there is no way to move
assign a reference.

The real motivation however is that this fixes the build of lld with
libstdc++ 4.6.

llvm-svn: 175481
2013-02-19 01:58:11 +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
Michael J. Spencer db18847b01 [ELF][Writer] Refactor Section to not have atoms. Move atoms into AtomSection.
The purpose of this change is to simplify creating non-atom sections.
Previously _contentType, _sectionKind and _order were used for multiple
purposes and collided in places. This moves all of the Atom specific logic down
into AtomSection and makes Section just have raw Elf_Shdr flags.

llvm-svn: 175207
2013-02-14 20:24:38 +00:00
Shankar Easwaran 4b9cea7317 fix the mergeable string atom, when the target points to a symbol which is at a relative offset from the start of the .rodata section
llvm-svn: 175039
2013-02-13 06:35:33 +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
Shankar Easwaran 0da6d71b54 add support for merging common strings
llvm-svn: 174990
2013-02-12 18:46:53 +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 710b4c8fa2 fix segment ordering of elf segments
llvm-svn: 174659
2013-02-07 20:33:55 +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 ac4f444e39 [docs] lld self hosts.
llvm-svn: 174592
2013-02-07 07:26:45 +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 7a0e212f6f [ELF][x86-64] Handle PLT32 relocations to IFUNC.
llvm-svn: 174428
2013-02-05 19:15:03 +00:00
Michael J. Spencer 7fec00b20e [ELF][Layout] Provide a proper way to get the TLS segment size.
llvm-svn: 174427
2013-02-05 19:14:43 +00:00
Michael J. Spencer 359b6ff6bb [ELF] Implement GOTPCREL for defined atoms.
llvm-svn: 174426
2013-02-05 19:14:28 +00:00
Michael J. Spencer e6ab9f80a7 [ELF] Replace local dynamic tls access with direct access.
llvm-svn: 174425
2013-02-05 19:14:07 +00:00
Michael J. Spencer be1100e192 [Resolver] Improve undefined symbol error.
llvm-svn: 174277
2013-02-03 10:50:06 +00:00
Michael J. Spencer 7b7e8edb86 [ELF] Use LLVM_IS_UNALIGNED_ACCESS_FAST.
llvm-svn: 174276
2013-02-03 10:49:57 +00:00