Commit Graph

2815 Commits

Author SHA1 Message Date
Lang Hames b09c2c6edb [lld] Allow LLD passes to return error codes.
llvm-svn: 240147
2015-06-19 17:51:46 +00:00
Simon Atanasyan 13cda3edf6 [Mips] Write inline some more relocation calculations
No functional changes.

llvm-svn: 239961
2015-06-17 22:28:16 +00:00
Simon Atanasyan f8b082a6aa [Mips] Support R_MICROMIPS_GPREL16 / R_MICROMIPS_GPREL7_S2 relocations handling
llvm-svn: 239960
2015-06-17 22:27:54 +00:00
Simon Atanasyan 17478c5804 [Mips] Support R_MIPS_16 relocation handling
llvm-svn: 239959
2015-06-17 22:27:39 +00:00
Simon Atanasyan 6f1e05f388 [Mips] Do not use functions to calculate trivial relocations
No functional changes.

llvm-svn: 239957
2015-06-17 22:27:27 +00:00
Davide Italiano 6cac62797f [ELF] Now that there's an API for ELF symbol types in LLVM, use it.
Common symbols will be handled in a separate patch because it seems
Hexagon redefines the notion of common symbol, which I'm not (yet)
very familiar with.

llvm-svn: 239951
2015-06-17 21:50:51 +00:00
Adhemerval Zanella b19f5cfee6 [ELF/x86_64] Fix initial-exec TLS access
Current approach for initial-exec in ELF/x86_64 is to create a GOT entry
and change the relocation to R_X86_64_PC32 to be handled as a GOT offfset.
However there are two issues with this approach: 1. the R_X86_64_PC32 is
not really required since the GOT relocation will be handle dynamically and
2. the TLS symbols are not being exported externally and then correct
realocation are not being applied.

This patch fixes the R_X86_64_GOTTPOFF handling by just emitting a
R_X86_64_TPOFF64 dynamically one; it also sets R_X86_64_TPOFF64 to be
handled by runtime one.  For second part, the patches uses a similar
strategy used for aarch64, by reimplementing buildDynamicSymbolTable
from X86_64ExecutableWriter and adding the TLS symbols in the dynamic
symbol table.

Some tests had to be adjusted due the now missing R_X86_64_PC32 relocation.
With this test the simple testcase:

* t1.c:

__thread int t0;
__thread int t1;
__thread int t2;
__thread int t3;

* t0.c:

extern __thread int t0;
extern __thread int t1;
extern __thread int t2;
extern __thread int t3;

__thread int t4;
__thread int t5;
__thread int t6;
__thread int t7;

int main ()
{
  t0 = 1;
  t1 = 2;
  t2 = 3;
  t3 = 4;

  t4 = 5;
  t5 = 6;
  t6 = 7;
  t7 = 8;

  printf ("%i %i %i %i\n", t0, t1, t2, t3);
  printf ("%i %i %i %i\n", t4, t5, t6, t7);

  return 0;
}

Shows correct output for x86_64.

llvm-svn: 239908
2015-06-17 14:00:12 +00:00
Adhemerval Zanella 9c5831f3de [ELF] Fix wrong TBSS size
This patch fixes the wrong .tbss segment size generated for cases where
multiple modules have non initialized threads variables.  For instance:

* t0.c

__thread int x0;
__thread int x1;
__thread int x2;

extern __thread int e0;
extern __thread int e1;
extern __thread int e2;
extern __thread int e3;

int foo0 ()
{
  return x0;
}

int main ()
{
  return x0;
}

* t1.c

__thread int e0;
__thread int e1;
__thread int e2;
__thread int e3;


lld is generating (for aarch64):

  [14] .tbss             NOBITS           0000000000401000  00001000
       0000000000000010  0000000000000000 WAT       0     0     4

Where is just taking in consideration the largest tbss segment, not all
from all objects.  ld generates a correct output:

  [17] .tbss             NOBITS           0000000000410dec  00000dec
       000000000000001c  0000000000000000 WAT       0     0     4

This issue is at 'lib/ReaderWriter/ELF/SegmentChunks.cpp' where
Segment<ELFT>::assignVirtualAddress is setting wrong slice values, not taking care
of although tbss segments file size does noy play role in other segment virtual
address placement, its size should still be considered.

llvm-svn: 239906
2015-06-17 13:46:07 +00:00
Denis Protivensky 1aaf736d89 [LinkerScript] Add matching of output sections to segments
Add method to query segments for specified output section name.
Return error if the section is assigned to unknown segment.
Check matching of sections to segments during layout on the subject of correctness.
NOTE: no actual functionality of using custom segments is implemented.

Differential Revision: http://reviews.llvm.org/D10359

llvm-svn: 239719
2015-06-15 08:00:51 +00:00
Rafael Espindola a0b4c565fd Don't use std::errc.
As noted on Errc.h:

// * std::errc is just marked with is_error_condition_enum. This means that
//   common patters like AnErrorCode == errc::no_such_file_or_directory take
//   4 virtual calls instead of two comparisons.

And on some libstdc++ those virtual functions conclude that

------------------------
int main() {
  std::error_code foo = std::make_error_code(std::errc::no_such_file_or_directory);
  return foo == std::errc::no_such_file_or_directory;
}
-------------------------

should exit with 0.

llvm-svn: 239685
2015-06-13 17:23:15 +00:00
Simon Atanasyan 6df6c75b61 [Mips] Support R_MIPS_PC16 relocation handling
llvm-svn: 239677
2015-06-13 14:48:14 +00:00
Simon Atanasyan 3d13c7dc67 [Mips] Use standard relocations R_MIPS_HI16/LO16 instead of custom variants
No functional changes.

llvm-svn: 239676
2015-06-13 14:48:04 +00:00
Rafael Espindola 9bd82e9952 Update for llvm api change.
llvm-svn: 239671
2015-06-13 12:50:13 +00:00
Simon Atanasyan 5f54812cb0 [Mips] Handle TLS relocations in -static linking mode
llvm-svn: 239615
2015-06-12 16:13:14 +00:00
Simon Atanasyan d5296b206b [Mips] Define _gpxxx symbols in both static/dynamic linking modes
llvm-svn: 239614
2015-06-12 16:13:00 +00:00
Simon Atanasyan 01cde9cf5a [Mips] Setup EI_ABIVERSION flag
- Set EI_ABIVERSION to '1' in case of non-PIC executable.
- Set EI_ABIVERSION to '3' in case of using FP64/FP64A floating point ABI.

llvm-svn: 239613
2015-06-12 16:12:50 +00:00
Simon Atanasyan 253fd15977 [Mips] Factor out some bit manipulation code into separate routines
No functional changes.

llvm-svn: 239226
2015-06-06 17:26:35 +00:00
Simon Atanasyan c859644f67 [Mips] Check symbol alignment for some MIPS relocations.
llvm-svn: 239225
2015-06-06 17:26:28 +00:00
Simon Atanasyan 439af8550e [Mips] Perform an overflow checking for relocations results
llvm-svn: 239224
2015-06-06 17:26:18 +00:00
Simon Atanasyan 26b1c4584d [Mips] Rearrange relocation related cases in the `switch` operator
No functional changes.

llvm-svn: 239223
2015-06-06 17:26:09 +00:00
Simon Atanasyan e801f43655 [Mips] Use signed/unsigned types in relocation calculations consistently
No functional changes.

llvm-svn: 239222
2015-06-06 17:26:04 +00:00
Simon Atanasyan 6d19105c1d [Mips] Handle all grouped relocations in a uniform way
No functional changes.

llvm-svn: 239221
2015-06-06 17:25:58 +00:00
Adhemerval Zanella c694b40590 [ELF/AArch64] Fix build issue on MSVC
This patch fixes a build issue from r238981.

llvm-svn: 238986
2015-06-03 22:47:41 +00:00
Adhemerval Zanella 9f0c63bfdf [ELF/AArch64] Fix TLS initial executable relocation
This patch fixes the TLS initial executable for AArch64.  Current
implementation have two issues: 1. does not generate dynamic
R_AARCH64_TLS_TPREL64 relocation for the external module symbols,
and 2. does not export the TLS initial executable symbol in dynamic
symbol table.

The fix follows the MIPS strategy to add a arch-specific GOTSection
class to keep track of TLS symbols required to be place in dynamic
symbol table. It also overrides the buildDynamicSymbolTable for
ExecutableWrite class to add the symbols.

It also adds some refactoring on AArch64RelocationPass.cpp based on ARM
backend.

llvm-svn: 238981
2015-06-03 21:44:03 +00:00
Adhemerval Zanella 4bcc13d988 [ELF/AArch64] Fix correct TCB aligment calculation
This patch fixes the TLS local relocations alignment done by @238258.
As pointed out, the TLS size should not be considered, but rather the
TCB size based on maximum output segment alignment.  Although it has
not shown in the TLS simple cases for test-suite, more comprehensible
tests with more local TLS variable showed wrong relocations values
being generated.

The local TLS testcase is expanded to add more tls variable (both
exported and static) initialized or not.

llvm-svn: 238960
2015-06-03 20:39:30 +00:00
Denis Protivensky dad8aa8241 [Mips] Fix enumeral vs. non-enumeral warning in ternary. NFC
That's a weird gcc's complain.

llvm-svn: 238812
2015-06-02 09:22:38 +00:00
Simon Atanasyan faa8bfdd1a [Mips] Add a couple of MipsAbiInfoHandler functions to check linked code type
No functional changes.

llvm-svn: 238689
2015-05-31 20:37:22 +00:00
Simon Atanasyan 2944e4a43d [Mips] Do not put the .reginfo section into the separate segment
The .reginfo should not belong to the separate segment if there is
a .MIPS.abiflags section.

llvm-svn: 238688
2015-05-31 20:37:13 +00:00
Simon Atanasyan c140b41c39 [Mips] Sort segments so PT_MIPS_ABIFLAGS goes right after the PT_INTERP
llvm-svn: 238687
2015-05-31 20:36:58 +00:00
Simon Atanasyan c90c425735 [Mips] Reading, merging and writing .MIPS.abiflags section
http://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking

llvm-svn: 238686
2015-05-31 20:36:43 +00:00
Simon Atanasyan 3eec407a53 [Mips] Delete MipsReginfo structure. Use the Elf_Mips_RegInfo instead.
llvm-svn: 238685
2015-05-31 20:36:21 +00:00
Simon Atanasyan 70e21bc83d [Mips] Collect all ABI related info in the single MipsAbiInfoHandler class
New MipsAbiInfoHandler merges and hold both ELF header flags
and registries usage masks. In the future commits it will manage some
additional information.

llvm-svn: 238684
2015-05-31 20:36:11 +00:00
Rui Ueyama 411c636081 COFF: Add a new PE/COFF port.
This is an initial patch for a section-based COFF linker.

The patch has 2300 lines of code including comments and blank lines.
Before diving into details, you want to start from reading README
because it should give you an overview of the design.

All important things are written in the README file, so I write
summary here.

- The linker is already able to self-link on Windows.

- It's significantly faster than the existing implementation.
  The existing one takes 5 seconds to link LLD on my machine,
  while the new one only takes 1.2 seconds, even though the new
  one is not multi-threaded yet. (And a proof-of-concept multi-
  threaded version was able to link it in 0.5 seconds.)

- It uses much less memory (250MB vs. 2GB virtual memory space
  to self-host).

- IMHO the new code is much simpler and easier to read than
  the existing PE/COFF port.

http://reviews.llvm.org/D10036

llvm-svn: 238458
2015-05-28 19:09:30 +00:00
Michael J. Spencer 42a738198b Fix unused variable warnings.
llvm-svn: 238384
2015-05-28 00:29:56 +00:00
Michael J. Spencer cc0554d057 Add PHDR and FILL parsing.
llvm-svn: 238383
2015-05-28 00:14:58 +00:00
Simon Atanasyan 06eccbea9d [Mips] Move member function definitions to cpp files
No functional changes.

llvm-svn: 238310
2015-05-27 11:56:15 +00:00
Simon Atanasyan bb399f3d57 [ELF][Mips] Do not merge ELF flags in the `isCompatible` routine
We do not need to merge ELF flags from DSO. But `isCompatible` is called
for all input files. So this change move ELF flags merging into the
MipsELFFile class.

llvm-svn: 238304
2015-05-27 08:45:31 +00:00
Simon Atanasyan 256f2cadfe [Mips] Factor out look up of Elf_Mips_RegInfo structure into the separate function
No functional changes.

llvm-svn: 238303
2015-05-27 08:45:21 +00:00
Adhemerval Zanella f3c1c065aa [ELF/AArch64] Fix local TLS relocations
This patch fixes the R_AARCH64_TLSLE_ADD_TPREL_HI12 and R_AARCH64_TLSLE_ADD_TPREL_LO12_NC
handling by using the correct offset by using the target layout along with
aarch64 alignments requirements.

It fixes the TLS test-suite SingleSource failures for aarch64:

* SingleSource/UnitTests/Threads/2010-12-08-tls.execution_time
* SingleSource/UnitTests/Threads/tls.execution_time

llvm-svn: 238258
2015-05-26 21:49:39 +00:00
Denis Protivensky 499292dede [ARM] Fix enum type cast in switch
It caused warning in clang assuming the default
branch would never be reached with the given
switch key type.

llvm-svn: 238194
2015-05-26 11:13:09 +00:00
Denis Protivensky 02fc0b1d64 [ARM] Move out .ARM.exidx related things to ARM backend
llvm-svn: 238191
2015-05-26 10:26:15 +00:00
Simon Atanasyan b48abf5dac [Mips] Use structures declared in the llvm/Object/ELFTypes.h
No functional changes.

llvm-svn: 238189
2015-05-26 08:48:33 +00:00
Simon Atanasyan e62aa7457f [Mips] Add Elf_Mips_Options::getRegInfoDesc() function to retrieve an ODK_REGINFO descriptor
No functional changes.

llvm-svn: 238176
2015-05-26 06:05:07 +00:00
Simon Atanasyan e09faec16e [Mips] Make the code shorter - use LLVM_ELF_IMPORT_TYPES_ELFT macro
No functional changes.

llvm-svn: 238175
2015-05-26 06:05:01 +00:00
Davide Italiano 683703ea6d [ELF] Add support for -z origin/now options.
Differential Revision:	http://reviews.llvm.org/D9963

llvm-svn: 238169
2015-05-26 01:57:32 +00:00
Simon Atanasyan 0b22359858 [ELF] Fix lld when no unique sections is used
Original patch of Shankar Easwaran with additional test case.
The yaml2obj does not allow to create an object file with non-unique
sections names so the fix uses a binary input object file in the test
case.

llvm-svn: 238115
2015-05-24 16:19:27 +00:00
Benjamin Kramer ebcc0dcad1 Remove redundant std::move on functions that return a unique_ptr.
llvm-svn: 238034
2015-05-22 17:52:04 +00:00
Benjamin Kramer 91d8cfd698 [ELF] Remove redundant unique_ptr moves found by -Wpessimizing-move.
llvm-svn: 238030
2015-05-22 16:01:21 +00:00
Benjamin Kramer fc99f3d43f [ELF] Fix shared CMake build.
llvm-svn: 238029
2015-05-22 16:01:12 +00:00
Denis Protivensky f2c22f4ff8 [ARM] report_fatal_error for not implemented functionality
llvm-svn: 238017
2015-05-22 12:39:05 +00:00
Denis Protivensky 575f7d4f1c [ARM] Ability to add GOT and PLTGOT entries for same symbol
These two serve different purpose:
PLTGOT entries are (usually) lazily resolved and serve as trampolines
to correctly call dynamically linked functions. They often have
R_*_JUMP_SLOT dynamic relocation type used.
Simple GOT entries hold other things, one of them may be
R_*_GLOB_DAT to correctly reference global and static data. This
is also used to hold dynamically linked function's address.

To properly handle cases when shared object's function is called
and at the same time its address is taken, we need to be able to have
both GOT and PLTGOT entries bearing different dynamic relocation types
for the same symbol.

llvm-svn: 238015
2015-05-22 11:23:39 +00:00
Denis Protivensky 214122cffc [ARM] Implement R_ARM_GLOB_DAT for GOT entries
This is used when referencing global or static data in shared
objects. This is also used when function's address is taken and
function call is made indirectly.

llvm-svn: 238014
2015-05-22 11:00:31 +00:00
Lang Hames ff4b13c538 [lld] Make the MachO -stack_size default '0', add a test case.
Addresses some review comments for r237841.

llvm-svn: 237979
2015-05-22 00:25:34 +00:00
Davide Italiano 339191fcfa [ELF] Simplify dynamic table entry creation.
Differential Revision:	http://reviews.llvm.org/D9921
Reviewed by:  atanasyan

llvm-svn: 237973
2015-05-21 23:44:19 +00:00
Denis Protivensky af1c9dd513 [ARM] Add dynamic symbols to the dynamic library writer
llvm-svn: 237898
2015-05-21 12:52:00 +00:00
Denis Protivensky eb273b6b28 [ARM] Remove useless file with writer's instantiation stub
llvm-svn: 237896
2015-05-21 12:31:15 +00:00
Denis Protivensky db2b179b1e [ARM] Remove unused field in executable writer
llvm-svn: 237892
2015-05-21 11:50:54 +00:00
Denis Protivensky ad52e44e98 [ARM] Move out common Writer functionality to ARMELFWriter
llvm-svn: 237891
2015-05-21 11:16:40 +00:00
Denis Protivensky 30e40be080 [ELF] Move start/end atom method assignment to OutputELFWriter. NFC
llvm-svn: 237886
2015-05-21 10:11:27 +00:00
Denis Protivensky e6651618a8 [ARM] Remove unused fields in dynamic library writer
llvm-svn: 237883
2015-05-21 09:52:21 +00:00
Denis Protivensky 2db1a03b07 [ARM] Add skeleton implementation of DSO linking
llvm-svn: 237881
2015-05-21 09:28:25 +00:00
Lang Hames 65a64c9c29 [LLD] Add support for the -stack_size option to Darwin ld.
llvm-svn: 237841
2015-05-20 22:10:50 +00:00
Denis Protivensky 56b12d75bf [ARM] Add needed symbols during dynamic executable linking
These include _GLOBAL_OFFSET_TABLE_ and _DYNAMIC.

llvm-svn: 237791
2015-05-20 13:39:33 +00:00
Lang Hames 3d2911f5cd [LLD] Make sure MachO FDEs read their augmentation data strings from the right
CIE, not just the most recently encountered one.

llvm-svn: 237491
2015-05-16 00:08:02 +00:00
Lang Hames f7c163c986 [LLD] Properly relocate the LSDA field of MachO eh-frames.
Previously the LSDA field was not being relocated during linking, leading to
failures for some EH tests.

llvm-svn: 237222
2015-05-13 00:44:47 +00:00
Lang Hames 6483c00079 [LLD] Add support for MachO ripRel32MinusNAnon relocations.
llvm-svn: 237219
2015-05-13 00:29:43 +00:00
Lang Hames 9bbc3653c5 [LLD] Add a mutex to prevent concurrent modification of the dylib maps in
MachOLinkingContext.

llvm-svn: 237217
2015-05-13 00:17:08 +00:00
Davide Italiano d3142ec82b [ARM] Use the correct variable name and unbreak buildbot.
llvm-svn: 236880
2015-05-08 16:49:18 +00:00
Leny Kholodov bde4144338 [ARM] Generation of .ARM.exidx/.ARM.extab sections
This patch provides generation of .ARM.exidx & .ARM.extab sections which are
used for unwinding. The patch adds new content type typeARMExidx for atoms from
.ARM.exidx section and integration of atoms with such type to the ELF
ReaderWriter. exidx.test has been added with checking of contents of .ARM.exidx
section and .ARM.extab section.

Differential Revision: http://reviews.llvm.org/D9324

llvm-svn: 236873
2015-05-08 16:04:11 +00:00
Denis Protivensky 679c2c3639 [ARM] Check overflow of R_ARM_THM_JUMP11
llvm-svn: 236842
2015-05-08 12:45:11 +00:00
Denis Protivensky 73e927885c [ARM] Check overflow of R_ARM_CALL/JUMP24
llvm-svn: 236841
2015-05-08 12:36:40 +00:00
Denis Protivensky a0cffffcfa [ARM] Check overflow of R_ARM_THM_CALL/JUMP24
llvm-svn: 236839
2015-05-08 12:34:43 +00:00
Denis Protivensky 1a3bd31e52 [ARM] Check overflow of R_ARM_PREL31
llvm-svn: 236729
2015-05-07 14:05:30 +00:00
Denis Protivensky cf4e031b36 [ARM] llvm_unreachable => make_dynamic_error in R_ARM_BASE_PREL
llvm-svn: 236727
2015-05-07 13:44:51 +00:00
Denis Protivensky aaeba9ebb9 [ARM] llvm_unreachable => make_*_reloc_error in group relocs
llvm-svn: 236726
2015-05-07 13:41:44 +00:00
Denis Protivensky bc11ba4061 [ARM] Return directly from switch in relocation handler
llvm-svn: 236724
2015-05-07 13:12:11 +00:00
Denis Protivensky 9c3738ccef [ARM] Add return codes to relocation handlers
llvm-svn: 236723
2015-05-07 12:44:20 +00:00
Davide Italiano 06b21daf00 Revert unrelated chunk committed by accident in r236334.
The change is likely to be correct, but unrelated to the aforementioned
commit and needs a test to gets shipped. Sorry.

llvm-svn: 236336
2015-05-01 19:24:29 +00:00
Davide Italiano 9de946fa1f [ELF] Fix test for .init_array.
Change the test so that it tests the right functionality.
Also put a description with the code from which the test was generated.
Reported by Simon Atanasysan.

llvm-svn: 236334
2015-05-01 19:20:48 +00:00
Davide Italiano 0e4a3addf0 [ELF] Mark linker defined symbols as .hidden when needed.
I noticed that gold mark these as hidden. While at it I rewrote the test for
this feature to use yaml rather than an object file as input.

Differential Revision:	http://reviews.llvm.org/D9418
Reviewed by:	ruiu

llvm-svn: 236291
2015-05-01 00:07:11 +00:00
Davide Italiano f14fbcbf91 [GNU] Remove -x/-X from the list of options to be implemented.
llvm-svn: 236149
2015-04-29 20:35:58 +00:00
Rafael Espindola ed48e53d60 Use MemoryBufferRef instead of MemoryBuffer&. NFC.
This just reduces the noise from another patch.

llvm-svn: 235933
2015-04-27 22:48:51 +00:00
Rui Ueyama de9215e498 ELF: Simplify LinkerScript detection. NFC.
llvm-svn: 235895
2015-04-27 16:54:48 +00:00
Adhemerval Zanella d31aadf515 Add missing snippets from r235880
llvm-svn: 235890
2015-04-27 15:13:17 +00:00
Adhemerval Zanella 6bf4da02c1 ELF/ARM: Ignore R_ARM_V4BX for ARMv4 but allow linking
This patch allow the ARM relocation R_ARM_V4BX to be processed by lld,
although it is not really handled in the static relocation code.  The
relocation is in the form:

Relocation section '.rel.text' at offset 0x428 contains 4 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000014  00000028 R_ARM_V4BX

Meaning it does have a direct target, but rather references to an absolute
section *ABS* (in this exemple to the .text segment itself).  It makes the
target Atom after file parse to not have a associated pointer and thus
generating a derrefence NULL point in ELFFile<ELFT>::findAtom.  Current
approach is just ignore and return nullptr in such cases.

The problem relies that default GCC configuration
for arm-linux-gnueabi{hf} emits the relocation for the asm:

--
.syntax unified
.arm

.p2align 2
.type fn, %function
fn:
  ldr r3, .LGOT
  ldr r2, .LGOT+4
.LPIC:
  add r3, pc, r3
  ldr r2, [r3, r2]
  cmp r2, #0
  bxeq lr
  b __start__
.LGOT:
 .word _GLOBAL_OFFSET_TABLE_-(.LPIC+8)
 .word __start__(GOT)
--

But only with the option -march=armv4 (which is the default GCC configuration).
For arm5 and forward the relocation is not created. This a special relocation
(defined miscellaneous for ARM) that instruct the linker to replace the bx
instruction into a mov.  GNU linker has some options related to which substitution
it can create for such cases.

With this patch I can dynamically link an application against a GLIBC
arm-linux-gnueabi system configured with default GCC.

llvm-svn: 235880
2015-04-27 13:55:14 +00:00
Rafael Espindola 6759319c3c Use MemoryBufferRef instead of MemoryBuffer&. NFC.
This just reduces the noise from another patch.

llvm-svn: 235776
2015-04-24 21:10:50 +00:00
Rafael Espindola b597408da4 Simplify parseMemberFiles to take a single file.
llvm-svn: 235751
2015-04-24 19:08:51 +00:00
Rafael Espindola 773a159116 Simplify now that there is only one file. NFC.
llvm-svn: 235747
2015-04-24 19:01:30 +00:00
Rafael Espindola ab5696ba82 Return ErrorOr<std::unique_ptr<File>>. NFC.
llvm-svn: 235744
2015-04-24 18:51:30 +00:00
Rafael Espindola c1d535af05 Remove unused enum value. NFC.
llvm-svn: 235742
2015-04-24 18:36:57 +00:00
Rafael Espindola dedab912c3 Return an ErrorOr<std::unique_ptr<File>>. NFC.
llvm-svn: 235741
2015-04-24 18:33:50 +00:00
Rafael Espindola c08ab8e6e4 Delete unnecessary generality in loadFile.
loadFile could load mulitple files just because yaml has a feature for
putting multiple documents in one file.

Designing a linker around what yaml can do seems like a bad idea to
me. This patch changes it to read a single file.

There are further improvements to be done to the api and they
will follow shortly.

llvm-svn: 235724
2015-04-24 15:51:45 +00:00
Simon Atanasyan e10a258527 [Mips] Simplify the code a bit using early return
No functional changes.

llvm-svn: 235708
2015-04-24 11:14:24 +00:00
Denis Protivensky 87d935dd09 [ARM] Update TODO notes
llvm-svn: 235706
2015-04-24 09:55:11 +00:00
Denis Protivensky c3431bf67b [ARM] Implement R_ARM_COPY relocation
This adds support of copying objects from shared libraries.

llvm-svn: 235705
2015-04-24 08:53:02 +00:00
Leny Kholodov 592cee666e [ARM] Update R_ARM_TARGET1 command line option names (remove prefix 'arm-')
Command line options --arm-target1-rel and --arm-target1-abs have been renamed to be compatible with GNU linkers.
Two tests have been updated:
  test/elf/options/target-specific-args.test
  test/elf/ARM/rel-arm-target1.test

Differential Revision: http://reviews.llvm.org/D9037

llvm-svn: 235499
2015-04-22 11:58:09 +00:00
Leny Kholodov 9e4292c0ec [ARM] Replace branches to undefined weak functions with NOP
According to the code model (ARM, Thumb, Thumb2) this patch updates the b/bl/blx 0 instructions with NOP.
test/elf/ARM/weak-branch.test has been added with tests for all available NOP (A1, T1, T2 encodings).

Differential Revision: http://reviews.llvm.org/D8807

llvm-svn: 235498
2015-04-22 11:47:53 +00:00
Simon Atanasyan 6668eb3c40 [Mips] Assign .MIPS.options section to the PT_LOAD segment
llvm-svn: 235488
2015-04-22 08:09:38 +00:00
Simon Atanasyan 5606dac67e [ELF] Allow TargetLayout descendants to control assignment sections to segments
The TargetLayout class puts two sections into the same segment if they
have equal segment types and the same section flags (SHF_xxx). To be
able to merge some sort of sections into the same segment we drop some
flags before comparison. For example to merge string sections into Data
segment we drop SHF_STRINGS and SHF_MERGE flags.

The patch allows TargetLayout descendants to drop some target specific
section flags. MIPS target needs that to merge .MIPS.options section
which has SHF_MIPS_NOSTRIP flag into the LOAD segment.

http://reviews.llvm.org/D9160

llvm-svn: 235487
2015-04-22 07:57:35 +00:00
Denis Protivensky 4b0abddeea [ARM] Implement veneers for dynamic executable linking
llvm-svn: 235486
2015-04-22 07:51:26 +00:00
Denis Protivensky f6c8938edd [ARM] Move veneer generators to base class. NFC
llvm-svn: 235485
2015-04-22 07:45:55 +00:00
Denis Protivensky 38b09f529c [ARM] Rename static veneer atoms to absolute code veneer atoms
No functional changes.

llvm-svn: 235484
2015-04-22 07:38:47 +00:00
Simon Atanasyan acd58af7df [ELF] Change return type of the OutputSection::flags() method
This method returns _flags field which has `uint64_t` type. Now the
field's type and the method's return type are consistent.

llvm-svn: 235393
2015-04-21 17:02:49 +00:00
Simon Atanasyan 72026b013b [ELF] Narrow down the type of OutputSection::_sections container
The `OutputSection::appendSection()` method always gets a pointer
to the `Section` class descendants. So it is not necessary to keep them
in the vector of `Chunk` pointers.

No functional changes.

llvm-svn: 235392
2015-04-21 17:02:42 +00:00
Simon Atanasyan fcb19e19d0 [Mips] Write .reginfo section into the separate PT_MIPS_REGINFO segment
llvm-svn: 235391
2015-04-21 17:02:35 +00:00
Simon Atanasyan d64f8a5188 [ELF] Simplify class memeber function declaration
No functional changes.

llvm-svn: 235390
2015-04-21 17:02:27 +00:00
Davide Italiano 037cfdd1db --discard-locals should be --discard-all here.
Sorry for the mistake/confusion.

llvm-svn: 235359
2015-04-20 22:54:50 +00:00
Davide Italiano 30326b9d8f [GNU/ELF] Add support for -X/--discard-locals.
There's (almost) never need to keep .L symbols around for production
builds. In fact, the FreeBSD kernel explicitly specify -X beacuse the
size impact (and the subsequent performance impact) might be significant,
because we keep symbols in memory.
I was tempted to make this the default, but I haven't (yet).

PR:		23232
llvm-svn: 235357
2015-04-20 22:52:56 +00:00
Simon Atanasyan 84adf3ff15 [Mips] Write DT_MIPS_OPTIONS tag to .dynamic section
If .MIPS.options section exists the DT_MIPS_OPTIONS tag should hold
an address of this section.

llvm-svn: 235290
2015-04-20 07:36:27 +00:00
Simon Atanasyan 8119228977 [Mips] Support R_MICROMIPS_PC18_S3/PC19_S2/PC21_S2/PC26_S2 relocations handling
llvm-svn: 235289
2015-04-20 07:34:52 +00:00
Simon Atanasyan 41ce98cc6f [Mips] Support R_MICROMIPS_GOT_DISP / PAGE / OFST relocations handling
llvm-svn: 235288
2015-04-20 07:33:02 +00:00
Davide Italiano 3d9e582a46 Accept --dynamic-linker <file>.
Before we only accepted --dynamic-linker=<file> and -dynamic-linker <file>
but older versions of GNU ld (e.g. 2.17.50) accept this other form, so
try to be compatible.

PR:		23233
llvm-svn: 235282
2015-04-19 23:45:41 +00:00
Davide Italiano 9a5b990f27 [GNU/ELF] Add support for -x/--discard-all.
PR:		23232
llvm-svn: 235247
2015-04-18 00:32:38 +00:00
Rui Ueyama e47aca8a6c Delete dead code (again).
llvm-svn: 235217
2015-04-17 18:58:34 +00:00
Rui Ueyama 3ff1170e5e Delete dead code.
llvm-svn: 235216
2015-04-17 18:54:29 +00:00
Denis Protivensky 0575c5de68 [ARM] Implement R_ARM_TLS_IE32 for dynamic executable
llvm-svn: 235182
2015-04-17 11:30:29 +00:00
Simon Atanasyan 09129d957c [Mips] clang-format the code
llvm-svn: 235033
2015-04-15 18:32:05 +00:00
Simon Atanasyan f4a87333ff [Mips] Remove redundant `.got` section lookup
No functional changes.

llvm-svn: 235032
2015-04-15 18:31:59 +00:00
Simon Atanasyan 834632cd1a [Mips] Create _GLOBAL_OFFSET_TABLE_ only if the .got section exists
llvm-svn: 235031
2015-04-15 18:31:53 +00:00
Simon Atanasyan fa21338a97 [Mips] Check `_gp_disp` symbol using a trivial string comparison
No functional changes.

llvm-svn: 235030
2015-04-15 18:31:44 +00:00
Denis Protivensky 0bcc491318 [ARM] Don't generate veneers when bl->blx fixup is possible
llvm-svn: 234991
2015-04-15 10:05:12 +00:00
Denis Protivensky 7f6b22ee84 [ARM] Pass Thumb flag to handler methods instead of atom
llvm-svn: 234989
2015-04-15 09:57:04 +00:00
Denis Protivensky 97375dc751 [ELF] Fix gcc -pedantic warnings (remove extra ';')
llvm-svn: 234981
2015-04-15 07:45:11 +00:00
Rui Ueyama bd94dbcf0a ELF: Attempt to simplify Segment::AssignVirtualAddress.
This is a retry of r234944.

llvm-svn: 234955
2015-04-14 23:11:14 +00:00
Rui Ueyama 13e41bcf9c temporary
llvm-svn: 234954
2015-04-14 23:11:12 +00:00
Rui Ueyama 0a57476c20 temporary
llvm-svn: 234953
2015-04-14 23:11:10 +00:00
Rui Ueyama ed796d518c ELF: Move Instrcution definition to HexagonEncoding.h.
HexagonEncodings.h contains a list of bitmasks. The file is used
only by HexagonRelocationHandler.cpp. The header is odd in the sense
that it uses struct Instruction but it doesn't define the data type.

This patch moves the struct definition to the header.

llvm-svn: 234947
2015-04-14 21:41:00 +00:00
Rui Ueyama ae9168b718 Revert "ELF: Attempt to simplify Segment::assignVirtualAddress()."
This reverts commit r234944 because it seems to have broken the buildbots.

llvm-svn: 234946
2015-04-14 21:38:39 +00:00
Rui Ueyama 5ec40d6e73 ELF: Attempt to simplify Segment::assignVirtualAddress().
This function is too long and complicated. Looks like new code was
added incrementaly without any refactoring. Maybe no one can describe
its exact semantics any more? It even contains copy-pastes inside it.

This patch is an (incomplete) attempt to simplify the function.
I tried to mechanically translate code to another form more intelligible.
I don't still understand the whole picture, but this patch shouldn't
change the linker's functionality.

llvm-svn: 234944
2015-04-14 21:20:37 +00:00
Davide Italiano b60453fe29 Rename ExecutableAtom.hpp to ExecutableAtom.h
This is for consistency with what's used elsewhere in lld tree.

llvm-svn: 234943
2015-04-14 21:06:56 +00:00
Rui Ueyama 921b8e93bb ELF: Remove redundant namespace qualifiers.
llvm-svn: 234938
2015-04-14 20:39:06 +00:00
Rui Ueyama 16d8e44da5 ELF: Simplify ELFDefinedAtom::contentType().
llvm-svn: 234936
2015-04-14 20:31:56 +00:00
Rui Ueyama 569e11af46 ELF: Split Atoms.h to Atoms.{h,cpp}.
llvm-svn: 234935
2015-04-14 20:21:53 +00:00
Rui Ueyama 2783469116 ELF: Split SegmentChunks.h to SegmentChunks.{h,cpp}.
llvm-svn: 234934
2015-04-14 20:12:50 +00:00
Rui Ueyama 06f70a087b ELF: Split HeaderChunks.h to HeaderChunks.{h,cpp}.
llvm-svn: 234932
2015-04-14 19:48:57 +00:00
Rui Ueyama befc11e007 ELF: Split SectionChunks.h to SectionChunks.{h,cpp}.
The size of AArch64TargetHander.cpp.o is now 4.1MB.

llvm-svn: 234931
2015-04-14 19:31:42 +00:00
Simon Atanasyan bdaab80160 [ELF] Use type helper Elf_Word instead of plain uint32_t data type
That helps to correctly write content of hash table if target and host
endianness are not the same. Right now that commit does not affect
any supported targets.

llvm-svn: 234928
2015-04-14 18:53:21 +00:00
Simon Atanasyan 1bd5d7e623 [ELF] Write whole std::vector using a single `memcpy` call
We do not need to iterate over `_buckets` and `_chains` vectors and
write all elements one by one.

No functional changes.

llvm-svn: 234927
2015-04-14 18:53:14 +00:00
Simon Atanasyan c0c4664618 [ELF] Remove redundant type cast to `char*` before passing array to memcpy
No functional changes.

llvm-svn: 234926
2015-04-14 18:53:09 +00:00
Simon Atanasyan 23025c812e [Mips] Write _DYNAMIC symbol on MIPS targets
llvm-svn: 234925
2015-04-14 18:53:03 +00:00
Rui Ueyama a852744a6a ELF: Split OutputELFWriter.h to OutputELFWriter.{h,cpp}.
The size of AArch64TargetHandler.cpp.o is now 4.5MB.

llvm-svn: 234916
2015-04-14 18:14:07 +00:00
Rui Ueyama 9d6ca7e272 ELF: Split TargetLayout.h into TargetLayout.{h,cpp}.
This patch makes AArch64TargetHandler.cpp.o from 8.5MB to 6.8MB.

llvm-svn: 234914
2015-04-14 18:04:57 +00:00
Rui Ueyama cfeb2512fd ELF: Remove ELFT template argument when referring the base class.
We don't need to repeat the template argument. They are not
ambiguous. MIPS is parameterized for ELFT, so we can't do this
for MIPS, though.

llvm-svn: 234913
2015-04-14 17:32:13 +00:00
Rui Ueyama 5557a0e688 Attempt to fix MSVC warning.
This patch tries to fix the following MSVC warning.

  warning C4661: 'bool
  lld:🧝:ELFFile<lld:🧝:ELF32LE>::isCompatible(unsigned
  char,unsigned char)' : no suitable definition provided for explicit
  template instantiation request

llvm-svn: 234909
2015-04-14 17:12:32 +00:00
Denis Protivensky 8f82dff193 [ARM] Implement mapping symbols for PLT0 entry
llvm-svn: 234876
2015-04-14 09:33:04 +00:00
Denis Protivensky 72a7581743 [ARM] Move out mapping atom functionality to a separate class
llvm-svn: 234874
2015-04-14 09:11:05 +00:00
Rui Ueyama ff499469e0 Simplify short switch-cases.
llvm-svn: 234869
2015-04-14 07:19:29 +00:00
Rui Ueyama 707504e0f2 Remove excessive parentheses.
llvm-svn: 234868
2015-04-14 07:09:05 +00:00
Rui Ueyama bf138134b0 ELF: Remove a header which is used only by one .cpp file.
The data and the inline function defined in the header is used only
by HexagonRelocationHandler.cpp.

llvm-svn: 234867
2015-04-14 07:09:03 +00:00
Rui Ueyama 92259f7fa3 Fix indentation.
llvm-svn: 234866
2015-04-14 06:58:48 +00:00
Rui Ueyama 76dff95a98 ELF: Fix odd initialization code.
llvm-svn: 234865
2015-04-14 06:58:47 +00:00
Rui Ueyama 25f9b4b752 temporary
llvm-svn: 234864
2015-04-14 06:58:45 +00:00
Rui Ueyama f9fffa7e11 ELF: Move function definitions from .h to .cpp.
llvm-svn: 234863
2015-04-14 06:47:06 +00:00
Rui Ueyama 2f43dbec0a ELF: Inline ELFReader typedefs which are used only once.
llvm-svn: 234862
2015-04-14 06:22:53 +00:00
Rui Ueyama f3691620da ELF: Make common strings file-scoped constants.
llvm-svn: 234861
2015-04-14 06:08:07 +00:00
Rui Ueyama f505ccf451 ELF: Make ARMELFMappingAtom a non-template class.
llvm-svn: 234860
2015-04-14 05:21:26 +00:00
Rui Ueyama da3a9a1b0b ELF: Remove this-> as much as we can.
These this-> are there because their classes were templated.
They are no longer templated.

llvm-svn: 234859
2015-04-14 05:14:49 +00:00
Rui Ueyama 4caff31217 ELF: Remove ELFT parameter from ARMELFFile.
llvm-svn: 234858
2015-04-14 05:14:46 +00:00
Rui Ueyama ff8bc5680a ELF: Make HexagonFile a non-template class.
llvm-svn: 234857
2015-04-14 05:14:44 +00:00
Rui Ueyama 3996563428 Remove dead code.
llvm-svn: 234854
2015-04-14 04:54:01 +00:00
Rui Ueyama 7bda84d25e ELF: Remove ELFT and LinkingContext template parameters from ELFReader.
Previously, ELFReader takes three template arguments: EFLT,
LinkingContextT and FileT. FileT is itself templated.
So it was a bit complicated. Maybe too much.

Most architectures don't actually need to be parameterized for ELFT.
For example, x86 is always ELF32LE and x86-64 is ELF64LE.
However, because ELFReader requires a ELFT argument, we needed
to parameterize a class even if not needed.

This patch removes the parameter from the class. So now we can
de-templatize such classes (I didn't do that in this patch, though).

This patch also removes ContextT parameter since it didn't have to be
passed as a template argument.

llvm-svn: 234853
2015-04-14 04:53:57 +00:00
Rui Ueyama e75e50c045 Define make_dynamic_error_code(const char *).
The function took either StringRef or Twine. Since string literals are
ambiguous when resolving the overloading, many code calls used this
function with explicit type conversion. That led awkward code like
make_dynamic_error_code(Twine("Error occurred")).

This patch adds a function definition for string literals, so that
you can directly call the function with literals.

llvm-svn: 234841
2015-04-14 02:34:09 +00:00
Rui Ueyama 18783cea3f ELF: Remove almost empty class.
llvm-svn: 234834
2015-04-14 01:15:43 +00:00
Rui Ueyama 97d30b87f3 Remove unused variable.
llvm-svn: 234831
2015-04-14 01:10:19 +00:00
Rui Ueyama a5b6859ac4 ELF: Use less templates for ELF types.
These classes are templated but actually instantiated for only
one ELF type.

llvm-svn: 234830
2015-04-14 00:59:04 +00:00
Rui Ueyama ad87e54f1a ELF: Define ELF{32,64}{LE,BE} types and use them everywhere.
llvm-svn: 234823
2015-04-14 00:31:28 +00:00
Rui Ueyama d610a96d15 ELF: Remove useless templates that takes always the same ELF type.
llvm-svn: 234820
2015-04-14 00:08:09 +00:00
Rui Ueyama 243226852f ELF: Fix headers including each other.
HexagonSectionChunks.h and HexagonTargetHandler.h include each other.
This patch removes the former and merge it with the latter.

llvm-svn: 234817
2015-04-13 23:47:53 +00:00
Rui Ueyama 4bd8ece689 ELF: Move definitions from {Dynamic,ELF}File.h to .cpp files.
DynamicFile and ELFFile are instantiated for four different types,
ELF{32,64}{BE,LE}. Because the classes are instantiated in each
compilation unit, including the header file makes object files
10MB larger.

On Windows, issue of excessive template instantiation is critical,
since the regular COFF file supports only up to 65534 sections.
(We could use the extended COFF file format, but generating that
much COMDAT sections is not a good thing in the first place
because it means long compile time and long link time.)

I confirmed that this change makes AArch64TargetHandler.cpp.o
from 21MB to 8.5MB. It feels still too large, but I think it's
a good start.

llvm-svn: 234808
2015-04-13 22:52:11 +00:00
Rui Ueyama fa92b4c9d8 ELF: Simplify alignment check. NFC.
llvm-svn: 234791
2015-04-13 20:04:50 +00:00
Rui Ueyama cfba8b3481 ELF: s/ELFTy/ELFT/ for consistency.
llvm-svn: 234790
2015-04-13 20:04:48 +00:00
Rui Ueyama 3245a395c1 Remove else after return.
llvm-svn: 234784
2015-04-13 19:56:08 +00:00
Rui Ueyama 09dfd2544e Fix formatting and remove excessive parentheses.
llvm-svn: 234781
2015-04-13 19:24:00 +00:00
Simon Atanasyan 44e904581d [Mips] Rollback explicit instantiation of MipsELFFile template class
This is a follow-up to r234728 and r234729. It looks like explicit
instantiation of `MipsELFFile` is redundant and triggers Visual C++ warning.

llvm-svn: 234756
2015-04-13 15:32:42 +00:00
Adhemerval Zanella cced470374 ELF/Aarch64: Add overflow checks for relocation writes
This patch adds support for overflow checking when processing
R_AARCH64_CALL26, R_AARCH64_JUMP26, R_AARCH64_CONDBR19,
R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, and R_AARCH64_TLSLE_ADD_TPREL_HI12
relocations.

llvm-svn: 234749
2015-04-13 12:14:14 +00:00
Adhemerval Zanella b79cea9180 ELF/AArch64: Add tests for ADR_PREL_LO21
Add default and overflow checking when processing
R_AARCH64_ADR_PREL_LO21 relocations.

llvm-svn: 234747
2015-04-13 12:11:23 +00:00
Adhemerval Zanella 0c2f3bcd67 [PATCH 08/10] ELF/Aarch64: Add R_AARCH64_ADR_GOT_PAGE and R_AARCH64_LD64_GOT_LO12_NC checks
This patch adds R_AARCH64_ADR_GOT_PAGE overflow and R_AARCH64_LD64_GOT_LO12_NC
unaligned value checks.

llvm-svn: 234746
2015-04-13 12:08:21 +00:00
Adhemerval Zanella 6f6472c41a ELF/Aarch64: Internal variable cleanup
This patch makes the AArch64GotAtomContent, AArch64Plt0AtomContent, and
AArch64PltAtomContent static and also cleanup their formatting.

llvm-svn: 234745
2015-04-13 11:44:44 +00:00
Adhemerval Zanella c55179f847 ELF/AArch64: Check ADR_PREL_PG_HI21 for overflow
Add support for overflow checking when processing
R_AARCH64_ADR_PREL_PG_HI21 relocations and add test.

Patch Will Newton.

llvm-svn: 234743
2015-04-13 11:42:06 +00:00
Adhemerval Zanella 3274a849f4 ELF/AArch64: Add support for R_AARCH64_PREL16
Add support for the R_AARCH64_PREL16 relocation type and add tests.

Patch by Will Newton.

llvm-svn: 234742
2015-04-13 11:40:50 +00:00
Adhemerval Zanella 4def013264 ELF/AArch64: Add support for R_AARCH64_PREL64
Add support for the R_AARCH64_PREL64 relocation type and add tests.

Patch by Will Newton.

llvm-svn: 234741
2015-04-13 11:38:41 +00:00
Adhemerval Zanella a5752c73db ELF/AArch64: Add support for checking PREL32 for overflow
Add support for overflow checking when processing R_AARCH64_PREL32
relocations and add tests.

Patch by Will Newton.

llvm-svn: 234740
2015-04-13 11:36:51 +00:00
Adhemerval Zanella 4c9bad3549 ELF/AArch64: Add support for R_AARCH64_ABS16
Add support for the R_AARCH64_ABS16 relocation type and add tests.

Patch by Will Newton.

llvm-svn: 234739
2015-04-13 11:34:06 +00:00
Hans Wennborg 2a76f41511 Speculative build fix for lld on Windows
I can't access my Windows machine at the moment, but the build was breaking with:

c:\b\build\slave\crwinclanglld\build\src\third_party\llvm\tools\lld\lib\readerwriter\elf\mips\MipsTargetLayout.h(38) : error C2440: 'return' : cannot convert from 'lld:🧝:MipsGOTSection<ELFT> *' to 'lld:🧝:AtomSection<ELFT> *'
        with
        [
            ELFT=lld:🧝:Mips32ELType
        ]
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

I think this regressed caused in 234727: that the forward-declarations
of MipsGOTSection<> is not enough.

llvm-svn: 234736
2015-04-13 11:00:22 +00:00
Denis Protivensky f40ef51feb [ARM] Use std::call_once for thread safe initialization
Thanks to r234628 & r234631

llvm-svn: 234733
2015-04-13 10:18:21 +00:00
Denis Protivensky 8830b93fac [ARM] Replace branch to unreachable with assertion
llvm-svn: 234732
2015-04-13 08:47:38 +00:00
Simon Atanasyan da46480c4d [Mips] Explicitly instantiate MipsELFFile template class
Use explicit instantiation to reduce object files size.

llvm-svn: 234729
2015-04-13 08:35:04 +00:00
Simon Atanasyan aaf3df3a00 [Mips] Create MipsTargetHandler class object using factory functions
Right now MIPS instantiates MipsTargetHandler using Mips32ELType and
Mips64ELType. And in the future we can add a couple more types. That
leads to the large object file size because compiler has to create
copies of MipsTargetHandler and all realted classes for each types used
for instantiation.

The patch introduces two factory functions and puts each of them into
the separate cpp file. That allows to reduce size of single object file.

llvm-svn: 234728
2015-04-13 08:34:56 +00:00
Simon Atanasyan 4bc35460df [Mips] Move `MipsTargetLayout` class to the separate header
llvm-svn: 234727
2015-04-13 08:34:46 +00:00
Simon Atanasyan 88698b66c9 [Mips] Support R_MICROMIPS_GOT_HI/LO16 and R_MICROMIPS_CALL_HI/LO16 relocations
llvm-svn: 234726
2015-04-13 08:20:57 +00:00
Simon Atanasyan 62f261b014 [Mips] Support R_MIPS_CALL_HI16 / R_MIPS_CALL_LO16 relocations handling
llvm-svn: 234725
2015-04-13 08:20:48 +00:00
Simon Atanasyan 077372889b [Mips] Support R_MIPS_GOT_HI16 / R_MIPS_GOT_LO16 relocations handling
llvm-svn: 234724
2015-04-13 08:20:34 +00:00
Nico Weber d9a21bf93a Revert r234649 "PECOFF: Use C++11 braced init list to make Version objects."
This doesn't compile with MSVC 2013:
include\lld/ReaderWriter/PECOFFLinkingContext.h(356) : error C2797:
    'lld::PECOFFLinkingContext::_imageVersion': list initialization
    inside member initializer list or non-static data member initializer
    is not implemented
include\lld/ReaderWriter/PECOFFLinkingContext.h(357) : error C2797:
    'lld::PECOFFLinkingContext::_imageVersion': list initialization
    inside member initializer list or non-static data member initializer
    is not implemented

llvm-svn: 234676
2015-04-11 01:32:52 +00:00
Rui Ueyama 942d51a25f Replace a macro with an inline function.
llvm-svn: 234650
2015-04-10 22:05:11 +00:00
Rui Ueyama 4d57247236 PECOFF: Use C++11 braced init list to make Version objects.
llvm-svn: 234649
2015-04-10 21:57:06 +00:00
Rui Ueyama 8330835197 Attempt to fix buildbots.
lldNative was removed in r234641.

llvm-svn: 234646
2015-04-10 21:42:16 +00:00
Rui Ueyama aabd7ca452 Do s/_context/_ctx/g globally.
I believe this patch eliminates all remaining uses of _context
or _linkingContext variable names. Consistent naming improves
readability.

llvm-svn: 234645
2015-04-10 21:40:59 +00:00
Rui Ueyama aa7b304ea7 Remove the Native file format.
The Native file format was designed to be the fastest on-memory or
on-disk file format for object files. The problem is that no one
is working on that. No LLVM tools can produce object files in
the Native, thus the feature of supporting the format is useless
in the linker.

This patch removes the Native file support. We can add it back
if we really want it in future.

llvm-svn: 234641
2015-04-10 21:23:51 +00:00
Rui Ueyama 74c629be81 ELF: Simplify assignments to "result"
This file is not -Wconversion-clean, and seems like we don't care
about that except these lines. Fix these lines for simplicity.

llvm-svn: 234637
2015-04-10 21:03:20 +00:00
Simon Atanasyan 720f52a961 [Mips] Add -pcrel-eh-reloc command line option
This MIPS specific option controls R_MIPS_EH relocation handling.
If -pcrel-eh-reloc is specified R_MIPS_EH relocation should be handled
like R_MIPS_PC32 relocation.

llvm-svn: 234635
2015-04-10 21:00:41 +00:00