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
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
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
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
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
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
Michael J. Spencer
7e813242af
[ELF][Reader] Improve performance by removing calls to malloc.
...
llvm-svn: 174275
2013-02-03 10:49:47 +00:00
Michael J. Spencer
9a1da075b2
[ELF] Fix uninitialized variable.
...
llvm-svn: 174274
2013-02-03 10:49:37 +00:00
Michael J. Spencer
4673da27ef
[Archive] Update to LLVM change.
...
llvm-svn: 174273
2013-02-03 10:49:26 +00:00
Shankar Easwaran
a47495898c
remove duplicate strings from the string table
...
llvm-svn: 174200
2013-02-01 18:06:15 +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
Shankar Easwaran
f23fc86ca8
add proper copyright header
...
llvm-svn: 174178
2013-02-01 15:05:11 +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
3c75665fdd
[ELF][x86-64] Add the _GLOBAL_OFFSET_TABLE_ Atom in the correct location.
...
Now we link against glibc without --noinhibit-exec.
llvm-svn: 174150
2013-02-01 05:36:14 +00:00
Michael J. Spencer
c8803d27aa
[ELF] Add more absolute atoms. Simplify how they are resolved.
...
llvm-svn: 174149
2013-02-01 05:36:00 +00:00
Shankar Easwaran
73ef70b50f
add hexagon scatter bits and split hexgontargethandler to hexagonrelocationhander
...
llvm-svn: 174148
2013-02-01 05:26:02 +00:00
Michael J. Spencer
280dadbbaf
[Core] Only complain about undefined symbols if they are marked as canBeNullNever.
...
llvm-svn: 174107
2013-01-31 22:56:13 +00:00
Michael J. Spencer
461d33648b
[ELF][x86-64] Improve unknown relocation message.
...
llvm-svn: 174092
2013-01-31 21:00:57 +00:00
Michael J. Spencer
3830d2c49f
[ELF] Create atoms for progbits sections with no symbols but still have content.
...
llvm-svn: 174091
2013-01-31 21:00:42 +00:00
Shankar Easwaran
fb8565a9c6
add support for assigning virtual addresses to TDATA/TBSS sections
...
llvm-svn: 174065
2013-01-31 16:04:47 +00:00
Michael J. Spencer
b3c04d28c8
[ELF] Fix circular initialization bug.
...
llvm-svn: 173968
2013-01-30 20:36:56 +00:00
Michael J. Spencer
901fd6a4c8
[ELF] Use the target's LayoutHandler.
...
llvm-svn: 173966
2013-01-30 20:05:27 +00:00
Shankar Easwaran
e07245cdfc
hexagon targetinfo changes for getting the relocation kind from string and vice versa
...
llvm-svn: 173942
2013-01-30 16:05:43 +00:00
Shankar Easwaran
ddb122811b
simplify hexagon relocations handling
...
llvm-svn: 173938
2013-01-30 15:38:41 +00:00
Michael J. Spencer
23d23953b3
[ELF][x86-64] Add TargetLayout.
...
llvm-svn: 173922
2013-01-30 10:43:25 +00:00
Michael J. Spencer
8254185eea
Whitespace.
...
llvm-svn: 173921
2013-01-30 10:43:10 +00:00
Michael J. Spencer
d21b72730f
[ELF] Remove ReferenceKinds.
...
llvm-svn: 173912
2013-01-30 07:46:54 +00:00
Michael J. Spencer
f35c3e434a
[ELF] Use TargetRelocationHandler to apply relocations.
...
llvm-svn: 173911
2013-01-30 07:46:31 +00:00
Michael J. Spencer
409a737f36
[ELF] Add {Hexagon,PPC,X86}TargetHandler.
...
llvm-svn: 173909
2013-01-30 07:36:45 +00:00
Shankar Easwaran
396e4c0b13
change DefaultLayout to TargetLayout inside member variables
...
llvm-svn: 173906
2013-01-30 07:19:57 +00:00
Shankar Easwaran
a6f00fe083
add targethandler hooks from Writer and cleanup
...
llvm-svn: 173904
2013-01-30 07:11:43 +00:00
Michael J. Spencer
457a77739b
[ELF][x86-64] Add X86_64TargetRelocationHandler and friends.
...
llvm-svn: 173897
2013-01-30 05:26:03 +00:00
Michael J. Spencer
4e9d9cd23b
[ELF] Add ELFTargetRelocationHandler.
...
llvm-svn: 173896
2013-01-30 05:25:44 +00:00
Michael J. Spencer
4260657fab
[ELF] Make AtomLayout more accessible.
...
This is needed to allow constant time access to the final layout of atoms.
llvm-svn: 173874
2013-01-30 01:25:06 +00:00
Michael J. Spencer
e68f90355c
[ELF] Chop the ELF prefix off of most things.
...
llvm-svn: 173838
2013-01-29 22:03:39 +00:00
Shankar Easwaran
185e8a076d
remove targetInfo and layout from ELFTargetLayout
...
llvm-svn: 173824
2013-01-29 20:13:16 +00:00
Michael J. Spencer
43ecac5a2c
[ELF] Fix header sort order.
...
llvm-svn: 173822
2013-01-29 19:53:41 +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
bf77be3ba5
[ELF] Give Chunk a ELFTargetInfo.
...
llvm-svn: 173743
2013-01-29 01:07:47 +00:00
Michael J. Spencer
adfb7eb211
[ELF] Remove OwningPtr from the Chunk::write interface.
...
llvm-svn: 173741
2013-01-29 01:00:21 +00:00
Michael J. Spencer
bdf8bc8315
[ELF] Clean up doxygen comments.
...
llvm-svn: 173740
2013-01-29 01:00:04 +00:00
Shankar Easwaran
072fb1a403
add register section, remove contentType from sectionKey
...
llvm-svn: 173709
2013-01-28 19:21:04 +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