Commit Graph

121 Commits

Author SHA1 Message Date
Shankar Easwaran be81dd757e [lld][ELF] process fini_array sections
This change processes fini_array section in addition to processing
init_array sections. This also makes functions registered at compile
time for initialization and finalization to be run during execution

llvm-svn: 189196
2013-08-25 18:05:12 +00:00
Shankar Easwaran f9fe6250ff [lld][ELF] Dont ignore zero sized sections.
There may be relocations that may be pointing to the section
even if the section sizes are 0. We shouldnot ignore them
for that regard.

llvm-svn: 189139
2013-08-23 20:03:35 +00:00
Shankar Easwaran d9e0a49357 [lld][ELF] Rename typeTLV content type for ELF
typeTLV content type is used by Darwin to represent thread local
storage. A new contentType has to be made to represent ELF
thread local storage data. These have been set to

- typeThreadZeroFill (represents TBSS storage)
- typeThreadData     (represents TDATA storage)

llvm-svn: 189137
2013-08-23 20:03:28 +00:00
Shankar Easwaran d17ba4bd4d [lld] handle typeZeroFill atoms in ELF/Native/YAML
BSS atoms dont take any file space in the Input file. They are associated
with a contentType(typeZeroFill). Similiar zero fill types also exist which
have the same meaning in terms of occupying file space in the Input.

These atoms have to be handled seperately when writing to the
lld's intermediate file or the lld test infrastructure.

Also adds a test.

llvm-svn: 189136
2013-08-23 20:03:21 +00:00
Shankar Easwaran c1ea4572ba [lld][Hexagon] Enable Hexagon sdata sorting test
llvm-svn: 188981
2013-08-22 03:02:17 +00:00
Shankar Easwaran e44104b001 add InputGraph functionality
llvm-svn: 188958
2013-08-21 22:57:10 +00:00
Michael J. Spencer 238cc72ec5 Update to llvm changes.
llvm-svn: 188021
2013-08-08 22:26:50 +00:00
Shankar Easwaran 53caafebdb [ELF] add -u/--undefined option, to define undefined symbols
llvm-svn: 184266
2013-06-19 00:31:09 +00:00
Shankar Easwaran f91031efcf [ELF] Add more sections to the default section map.
This change adds functionality to add more sections like .gcc_except_table,
.data.rel.local, .data.rel.ro into the default section map, so that they are
all merged into appropriate output sections.

This also makes c++ static binaries comparable to what you get with the default
linker.

Adds a test for testing the functionality.

llvm-svn: 184071
2013-06-17 02:29:36 +00:00
Shankar Easwaran a97f12e00a [ELF] Add test so that _end value is set appropriately for NMAGIC/OMAGIC executables(Fix comment from espindola)
llvm-svn: 184060
2013-06-16 15:06:18 +00:00
Shankar Easwaran a42a473893 [ELF] add NMAGIC/OMAGIC support
llvm-svn: 184055
2013-06-16 05:06:28 +00:00
Shankar Easwaran ec36f9a734 [test] fix test as the atom name is available only in DEBUG mode
llvm-svn: 183819
2013-06-12 00:46:37 +00:00
Shankar Easwaran 08470c4b6b [ELF][X86_64] Create GOT entries for external TLS symbols properly without Segfaults.
llvm-svn: 183817
2013-06-12 00:32:39 +00:00
Shankar Easwaran d5ff08ca5f [ELF] TBSS section has to be special cased so that it doesnot occupy memory space
llvm-svn: 183815
2013-06-12 00:32:32 +00:00
Rui Ueyama e3ee514aa7 [ELF] Refactor File.h.
- Split createAtom() in lib/ReaderWriter/ELF/File.h into small methods.
 - Added comments to code in other methods.

No functionality changes.

Reviewers: shankarke

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D921

llvm-svn: 183696
2013-06-10 21:32:44 +00:00
Rafael Espindola a0af48fc93 Fix handling of files without a symbol table.
This fixes a recent regression (r183338). Stripped elf files (like installed
crtn.o for example), are not required to have a symbol table. Handle that
correctly.

llvm-svn: 183573
2013-06-07 21:08:19 +00:00
Rafael Espindola e699c60021 Now that llvm-readobj is fixed, enable this test.
llvm-svn: 183285
2013-06-05 01:38:12 +00:00
Shankar Easwaran a5008e3a63 [lld][elf] Add --dynamic-linker option to the ELF linker.
Users can override the default value of the dynamic linker to be set to the
one that appears in the command line. The path can even be empty!. 

Added a test for the option.

llvm-svn: 182889
2013-05-29 22:51:01 +00:00
Shankar Easwaran d8da989e78 [lld][LayoutPass] An earlier commit moved the functionality so that Atoms would
be laid out by their ordinal overrides first, there was a bug that two atoms may 
get the same override index due to which atoms were not ordered properly. This
commit fixes the problem.

Now the atoms are ordered by 

- Section Position hints
- Atom override (Using layout-after/layout-before/in-group)
- Content Permissions
- Content Type
- File Ordinal

This also fixes the problem of running c++ static executables that 
was broken by an earlier patch.

llvm-svn: 182494
2013-05-22 17:41:04 +00:00
Rui Ueyama 0e171fe3c4 [lld] Update a test file for r180209.
This binary file is created from shared.c.

llvm-svn: 182410
2013-05-21 20:05:55 +00:00
Shankar Easwaran 9af77a2cab [lld][ELF][All Archs] Addend is used by dynamic relocations
only if they are relative. This removes the FIXME when the
relocations are being emitted and checks if the relocation
is relative and only then populates the addend information.

I couldnt add a testcase for this as llvm-readobj lacks     
functionality of printing dynamic relocations.              

When the functionality is added, remove the commented lines
from elf/ifunc.test to test functionality.

llvm-svn: 182077
2013-05-17 05:10:30 +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
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
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
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
Shankar Easwaran f4a5e2f439 [ELF][test] add dynamic library search
llvm-svn: 178840
2013-04-05 04:34:57 +00:00
Shankar Easwaran 831b4a0503 [test] remove printing the file to stdout
llvm-svn: 178817
2013-04-04 23:53:46 +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 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 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
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 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
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 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
Shankar Easwaran 3ff62ade38 [ELF] add dynamic library support
llvm-svn: 176483
2013-03-05 14:52:48 +00:00