Commit Graph

121 Commits

Author SHA1 Message Date
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 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 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
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 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 25832ede03 functionality to handle global atoms in Merge sections
llvm-svn: 175636
2013-02-20 17:38:37 +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
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 7799d15f6e [Driver] Add -L and -l support.
llvm-svn: 174590
2013-02-07 06:47:17 +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 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
Shankar Easwaran d476528e3d add alignment to .got/.got.plt/.plt sections & fix tests
llvm-svn: 174199
2013-02-01 18:03:32 +00:00
Michael J. Spencer 08b49bf27e [ELF][x86-64] Fix ifunc and add test.
In an previous commit I managed to completely disable the IRELATIVE relocation
writing code. I also used the wrong addend for the static relocation. Fix both
these issues and add a test. This test is quite brittle because there's no way
to do arithmetic on variables in FileCheck.

llvm-svn: 174161
2013-02-01 09:14:21 +00:00
Michael J. Spencer b5d6f5e988 [ELF][x86-64] Implement static relocation model for TLS.
This implements the static relocation model for GOT accesses to TLS.

llvm-svn: 174155
2013-02-01 07:14:14 +00:00
Michael J. Spencer b0ed8e80d8 [ELF][x86-84] Add static TLS support.
llvm-svn: 174154
2013-02-01 07:13:49 +00:00
Michael J. Spencer 289dcedea5 [ELF] Add support for IFUNC.
This sadly doesn't have a test for the final
output because llvm-objdump can't dump relocations
that don't belong to a section :(

llvm-svn: 173808
2013-01-29 16:38:03 +00:00
Michael J. Spencer d269a3e281 [ELF] Use correct regex in test.
llvm-svn: 173665
2013-01-28 06:11:39 +00:00
Michael J. Spencer 990ec2b223 [ELF] Use entry point from LinkerOptions.
Patch by Ahmed Bougacha!

llvm-svn: 173655
2013-01-28 04:15:44 +00:00
Michael J. Spencer 5ba1a96a10 [ELF][x86-64] Add relocation string<->kind.
llvm-svn: 173533
2013-01-25 23:48:58 +00:00
Michael J. Spencer 866e0f8a8c [ELF][X86-64] Use the correct base address.
llvm-svn: 173527
2013-01-25 23:23:24 +00:00
Michael J. Spencer 563d33a6f1 [ELF] Read IFUNC symbols correctly as typeResolver.
llvm-svn: 173299
2013-01-23 22:08:46 +00:00
Michael J. Spencer 64afcb4c6b Move everything over to TargetInfo.
I really would have liked to split this patch up, but it would greatly
complicate the lld-core and lld drivers having to deal with both
{Reader,Writer}Option and TargetInfo.

llvm-svn: 173217
2013-01-23 01:18:43 +00:00
Michael J. Spencer fe71a50494 Trailing whitespace.
llvm-svn: 172554
2013-01-15 21:13:14 +00:00
Michael J. Spencer 8b3898af26 [ELF] Never allocate content to weak symbols as they may be merged away.
This is done by creating a new non-weak anonymous symbol and creating
an atom with content for that symbol. This is added after the weak symbol
so that they have the same address.

llvm-svn: 172553
2013-01-15 21:13:02 +00:00
Michael J. Spencer ecd5f4062f [ELF] Add support for __init_array_{start,end}.
With this change c++ global constructors and destructors work.

llvm-svn: 172133
2013-01-10 22:41:42 +00:00
Michael J. Spencer 36b9b8f945 [ELF] Fix leading 0 count. Matches change in llvm.
llvm-svn: 172132
2013-01-10 22:41:19 +00:00
Shankar Easwaran 2ca8e7d733 support for adding linker defined symbols
llvm-svn: 172040
2013-01-10 03:16:27 +00:00
Michael J. Spencer cf2306fe2b Fix the elf/rodata.objtext test to work when first run.
llvm-svn: 171992
2013-01-09 20:10:30 +00:00
Nick Kledzik 8a3052eab0 Rename YAML key 'fixups:' to 'references:'
llvm-svn: 171898
2013-01-08 21:12:13 +00:00
Nick Kledzik 809b9955e8 Fix to work with style of new YAML writer
llvm-svn: 171897
2013-01-08 21:05:47 +00:00
Michael J. Spencer 8de8364753 [ELF] Properly handle constant data.
With this hello world works with dietlibc on x86-64 Linux.

llvm-svn: 171711
2013-01-07 08:00:42 +00:00
Michael J. Spencer 1ac382f0c5 [ELF] Emit the file header and program headers at the beginning of the first segment.
This is required for the loader to correctly set AT_PHDR.

With this lld can correctly link against dietlibc and get to main.

llvm-svn: 171709
2013-01-07 08:00:04 +00:00
Michael J. Spencer 28c6594c71 [ELF] Emit zeroFill as STT_OBJECT in the final executable. ld does this.
llvm-svn: 171704
2013-01-07 07:05:52 +00:00
Michael J. Spencer cdb892488e [ELF] Add common x86_64 relocation types.
llvm-svn: 171703
2013-01-07 06:58:53 +00:00
Michael J. Spencer 0c3f25ead9 [Driver] x86-64 should use ELF 64.
llvm-svn: 171693
2013-01-07 04:51:32 +00:00
Nick Kledzik 6b079f5e2f Removes files for separate ReaderYAML.cpp and WriterYAML.cpp
and adds a new file ReaderWriterYAML.cpp that uses YAML I/O.

Lots of tweaks to test suite for slightly different YAML encoding.

llvm-svn: 171592
2013-01-05 02:22:35 +00:00
Michael J. Spencer 3124422a8b [ELF] Add skeleton for X86-64 relocations.
llvm-svn: 171578
2013-01-05 00:47:04 +00:00
Shankar Easwaran 495d38bf46 add Changes to ELF Writer to layout sections/segments in the output executable
llvm-svn: 171135
2012-12-27 02:26:30 +00:00
Shankar Easwaran bbf9ddda04 changes for the ELF Reader : split up into AtomsELF.h/Adding new permissions permRWX
llvm-svn: 171127
2012-12-27 01:40:08 +00:00
Hemant Kulkarni 736f7fbee2 Populate entry point into ELF executable.
llvm-svn: 168461
2012-11-21 21:07:36 +00:00
Hemant Kulkarni 87dbac00a9 Add program header emission to ELF writer. This patch also rearranges sections for efficient memory utilization
llvm-svn: 167874
2012-11-13 21:34:45 +00:00
Shankar Easwaran 70b4dcfbcd Adding support to resolve symbols with archive libraries in lld
llvm-svn: 167854
2012-11-13 18:39:10 +00:00
Sid Manning 823e8bb7be This patch changes the following:
* Use conventional naming for KindHandlers.
  * Add X86 relocation routines.
  * Use std::function instead of function pointers in _fixupHandler map.
  * Change _fixupHandler map from std::map to llvm::DenseMap.
  * Add simple testcase for x86 relocations.

llvm-svn: 166700
2012-10-25 17:53:04 +00:00
Sid Manning 2a59024ff8 This update does the following:
* Moves enum Scope from DefinedAtom.h to Atom.h
  * Adds scope method to AbsoluteAtom class
  * Updates YAML to print scope of AbsoluteAtoms
  * Update Native Reader/Writer to handle this new, "attribute"
  * Adds testcase 
Reviewed and approved by Nick Kledzik

llvm-svn: 166189
2012-10-18 17:16:19 +00:00
Sid Manning 42064e5b60 * Add relocation reference support for Hexagon and PowerPC.
- Hexagon has many relocation types, this patch covers just
      a subset, more will be added.
    - PowerPC support was added so that we can verify mixed endian
      environments.
  * Add some basic test cases
  * Update ldd-core to accept -endian flag

llvm-svn: 165477
2012-10-09 02:20:47 +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 cc613e1c25 Changed test output comparison to be consistent with the way llvm-objdump and llvm-readobj work.
llvm-svn: 165048
2012-10-02 21:12:21 +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
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
Sid Manning 51b1cc1428 Add test cases for ReaderELF.
llvm-svn: 160737
2012-07-25 17:14:55 +00:00