Commit Graph

5075 Commits

Author SHA1 Message Date
Rafael Espindola a598a3a08a Mark R_AARCH64_CALL26 as relative.
llvm-svn: 261783
2016-02-24 22:07:12 +00:00
Rafael Espindola 47ed542328 Mark R_AARCH64_ADD_ABS_LO12_NC as relative.
llvm-svn: 261772
2016-02-24 21:48:06 +00:00
Rafael Espindola 57ca270b7a Mark R_AARCH64_LDST64_ABS_LO12_NC as relative.
llvm-svn: 261769
2016-02-24 20:52:58 +00:00
Rafael Espindola 40afcb547e Mark R_AARCH64_LDST32_ABS_LO12_NC as relative.
llvm-svn: 261766
2016-02-24 20:18:06 +00:00
Rafael Espindola 9a3bb54b2e R_AARCH64_LDST8_ABS_LO12_NC is effectivelly relative.
It only sets the low bits and given the page alignment of PT_LOAD the
dynamic linker can only change the high ones.

llvm-svn: 261765
2016-02-24 19:58:50 +00:00
Rafael Espindola c36e97ae39 R_AARCH64_ADR_PREL_PG_HI21 is relative.
llvm-svn: 261764
2016-02-24 19:36:30 +00:00
Rui Ueyama 733153de3c ELF: Do not instantiate InputSectionBase::Discarded.
"Discarded" section is a marker for discarded sections, and we do not
use the instance except for checking its identity. In that sense, it
is just another type of a "null" pointer for InputSectionBase. So,
it doesn't have to be a real instance of InputSectionBase class.

In this patch, we no longer instantiate Discarded section but instead
use -1 as a pointer value. This eliminates a global variable which
needed initialization at startup.

llvm-svn: 261761
2016-02-24 18:33:35 +00:00
Rafael Espindola 795dc5a0fb Move target independent code out of x86_64 only path.
The logic for deciding if an undefined symbol should have the value of a
got entry is not target specific.

llvm-svn: 261760
2016-02-24 18:24:23 +00:00
Rafael Espindola b508f520e7 Create implicit plt entries for R_X86_64_32S.
llvm-svn: 261749
2016-02-24 16:37:47 +00:00
Rafael Espindola a4e35f7092 Mark R_AARCH64_PREL32 as relative.
llvm-svn: 261747
2016-02-24 16:15:13 +00:00
George Rimar c3794e5834 [ELF] - replaced std::function with raw pointers in LinkerScript.cpp
Change as was proposed by David Blaikie.

Differential revision: http://reviews.llvm.org/D17499

llvm-svn: 261729
2016-02-24 09:21:47 +00:00
George Rimar cb2aeb66e4 [ELF] - Teach input section wildcard patterns to recognize '?' meta character.
`?' - matches any single character
https://sourceware.org/binutils/docs/ld/Input-Section-Wildcards.html

This is used in linker scripts.

Differential revision: http://reviews.llvm.org/D17290

llvm-svn: 261726
2016-02-24 08:49:50 +00:00
Rui Ueyama 5ac589171d ELF: Remove InputSectionBase::getAlign and instead add Align member.
This is a preparation for ICF. If we merge two sections, we want to
align the merged section at the largest alignment requirement.
That means we want to update the alignment value, which was
impossible before this patch because Header is a const value.

llvm-svn: 261712
2016-02-24 00:38:18 +00:00
Rui Ueyama 8fc070d64d ELF: Remove InputSectionBase::isLive and use Live member instead. NFC.
This is also a preparation for ICF.

llvm-svn: 261711
2016-02-24 00:23:15 +00:00
Rui Ueyama d7e4a281c4 ELF: Make some functions constant. NFC.
This is a preparation for ICF.

llvm-svn: 261710
2016-02-24 00:23:13 +00:00
Rui Ueyama 436d91d835 COFF: Temporarily remove flaky a test.
This test is flaky for more than half a year or so on buildbots
and has been causing confusion. Remove it while I'm investing the
cause.

llvm-svn: 261709
2016-02-24 00:23:11 +00:00
Rafael Espindola d5b688c8e8 Use a different error in test.
This opens the way for -r being implemented.

llvm-svn: 261682
2016-02-23 20:36:20 +00:00
Rafael Espindola 435c00f39c Fix the aarch64 logic for dynamic relocations.
There is nothing aarch64 specific in here. If a symbol can be preempted,
we need to copy the full relocation to the dynamic linker.

If a symbol cannot be preempted, we can make the dynamic linker life
easier and produce a relative relocation.

This is directly equivalent to R_X86_64_64 to R_x86_64_RELATIVE
conversion.

llvm-svn: 261678
2016-02-23 20:19:44 +00:00
Rafael Espindola f7ae359d2c Simplify. NFC.
llvm-svn: 261668
2016-02-23 18:53:29 +00:00
Rafael Espindola 75baf09be5 Don't include tbss's alignment in offset.
The .tbss section is in the middle of a PT_LOAD. Whatever treatment we
give to its address we must also give to the offset.

We were ignoring it for address computations, but not for offset.

Fixes pr26712.

llvm-svn: 261667
2016-02-23 18:39:55 +00:00
Rui Ueyama c89bff2ce1 Handle bitcode files in archive files with --whole-archive.
This patch moves BitcodeFile instantiation into createObjectFile.
Previously, we handle bitcode files outside that function and did
not handle for --whole-archive.

http://reviews.llvm.org/D17527

llvm-svn: 261663
2016-02-23 18:17:11 +00:00
Adhemerval Zanella 668ad0ffcb [lld] [ELF/AArch64] Fix R_AARCH64_ABS64 in Shared mode
This patch fixes the R_AARCH64_ABS64 relocation when used in shared mode,
where it requires a dynamic R_AARCH64_RELATIVE relocation. To correct set
the addend on the dynamic relocation (since it will be used by the dynamic
linker), a new TargetInfo specific hook was created (getDynRelativeAddend)
to get the correct addend based on relocation type.

The patch fixes the issues when creating shared library code against
{init,fini}_array, where it issues R_AARCH64_ABS64 relocation against
local symbols.

llvm-svn: 261651
2016-02-23 16:54:40 +00:00
Simon Atanasyan 7862c173c3 [ELF][MIPS] Rename test case. NFC
llvm-svn: 261617
2016-02-23 08:34:18 +00:00
George Rimar 481c2ce64b [ELF] - Linkerscript KEEP command.
When link-time garbage collection is in use (-gc-sections), it is 
often useful to mark sections that should not be eliminated. 
This is accomplished by surrounding an input section's wildcard 
entry with KEEP(). Patch implements that command.

Differential revision: http://reviews.llvm.org/D17242

llvm-svn: 261616
2016-02-23 07:47:54 +00:00
Rui Ueyama c00718fd8e Use TinyPtrVector<Ty *> instead of SmallVector<Ty *, 1>.
Thanks to Sean Silva for the suggestion.

llvm-svn: 261606
2016-02-23 03:34:37 +00:00
Rafael Espindola 8176d57d62 Handle a weak undefined tls to archive member.
A weak undefined should not fetch archive members, so we have to keep
the Lazy symbol.

That means the lazy symbol has to encode information about the original
weak undef.

Fixes pr25762.

llvm-svn: 261591
2016-02-22 23:19:29 +00:00
Rafael Espindola 5e8b54afdb Remove a trivial getter.
llvm-svn: 261590
2016-02-22 23:16:05 +00:00
Rafael Espindola fb1533b326 Don't create copy relocs in shared libraries.
This fixes PR26699.

llvm-svn: 261576
2016-02-22 21:23:29 +00:00
Rafael Espindola 56da313e86 Correctly handle two gd relocations to the same symbol.
Fixes PR26676.

llvm-svn: 261561
2016-02-22 19:57:55 +00:00
Rafael Espindola 6feecec0b0 Handle undef symbols in LTO.
This also handles bc files is archives.

llvm-svn: 261374
2016-02-19 22:50:16 +00:00
Rafael Espindola 7efa5be205 Add support for merging strings with alignment larger than one char.
This reduces the .rodata of scyladb from 4501932 to 4334639 bytes (1.038
times smaller).

I don't think it is critical to support tail merging, just exact
duplicates, but given the code organization it was actually a bit easier
to support both.

llvm-svn: 261327
2016-02-19 14:17:40 +00:00
George Rimar d2389bfd9d Attemp to heal windows buildbot
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/17414

llvm-svn: 261322
2016-02-19 11:56:49 +00:00
George Rimar f23b23200d [ELF] - Minor refactor of LinkerScript file
* Else-ifs in ScriptParser::run() replaced with std::function + map
* Reordered members of ScriptParser

Differential revision: http://reviews.llvm.org/D17256

llvm-svn: 261317
2016-02-19 10:45:45 +00:00
George Rimar e9e1d323c6 Fixed comments formatting. NFC.
llvm-svn: 261214
2016-02-18 15:17:01 +00:00
George Rimar 9bec24ab88 Renamed sh_type -> Type, sh_flags -> Flags in arguments. NFC.
llvm-svn: 261213
2016-02-18 14:20:08 +00:00
Simon Atanasyan 124be56bcc [ELF][MIPS] Update test case expectations due changes in MIPS/MC
llvm-svn: 261085
2016-02-17 12:49:43 +00:00
Rui Ueyama a2b1f45ded Make getOffset a member function of DynamicReloc<ELFT>.
Logically it belongs to DynamicReloc, and it is more readable to
be a member of the class.

llvm-svn: 261069
2016-02-17 06:08:42 +00:00
Rui Ueyama 861c731ccc Use shorter names for the .gnu.hash class.
llvm-svn: 261067
2016-02-17 05:40:03 +00:00
Rui Ueyama 91c0a5db01 Use stable_partition instead of erasing all elements and fill it again.
llvm-svn: 261066
2016-02-17 05:40:01 +00:00
Rui Ueyama c2e863a0d8 Use an accurate type instead of unsigned.
These values are offsets in the string table (which must fit in
host computer's memory space), so size_t is better than unsigned.

llvm-svn: 261065
2016-02-17 05:06:40 +00:00
Rui Ueyama 874e7aee29 Split SymbolTableSection::writeGlobalSymbols.
Previously, we added garbage-collected symbols to the symbol table
and filter them out when we were writing symbols to the file. In
this patch, garbage-collected symbols are filtered out from beginning.

llvm-svn: 261064
2016-02-17 04:56:44 +00:00
Rafael Espindola f8b8b7b5d0 Don't create multiple .got.plt entries for the same symbol.
We were doing it for ifunc symbols.

llvm-svn: 260980
2016-02-16 16:46:31 +00:00
Rafael Espindola 8ae1290058 Merge multiple tdata.* into a single section.
llvm-svn: 260977
2016-02-16 16:12:06 +00:00
Rafael Espindola 1492820aaa Merge multiple .gcc_except_table.* into a single section.
llvm-svn: 260976
2016-02-16 16:05:27 +00:00
Rafael Espindola b032aa1b2b Merge multiple .tbss.* sections into one output section.
llvm-svn: 260974
2016-02-16 15:57:07 +00:00
Rafael Espindola 79944f20ea Start adding release notes for lld.
llvm-svn: 260960
2016-02-16 13:12:55 +00:00
Saleem Abdulrasool c0571e1261 ELF: silence -Wcast-qual warnings from GCC
Silence 4 -Wcast-qual warnings from GCC 5.1.  NFC.

llvm-svn: 260871
2016-02-15 03:45:18 +00:00
Rui Ueyama 1ebc8ed78a ELF: Add wildcard pattern matching to SECTIONS linker script command.
Each rule in SECTIONS commands is something like ".foo *(.baz.*)",
which instructs the linker to collect all sections whose name matches
".baz.*" from all files and put them into .foo section.

Previously, we didn't recognize the wildcard character. This patch
adds that feature.

Performance impact is a bit concerning because a linker script can
contain hundreds of SECTIONS rules, and doing pattern matching against
each rule would be too expensive. We could merge all patterns into
single DFA so that it takes O(n) to the input size. However, it is
probably too much at this moment -- we don't know whether the
performance of pattern matching matters or not. So I chose to
implement the simplest algorithm in this patch. I hope this simple
pattern matcher is sufficient.

llvm-svn: 260745
2016-02-12 21:47:28 +00:00
Rafael Espindola ac458405bf Trying to fix the MSVC build.
llvm-svn: 260743
2016-02-12 21:36:59 +00:00
Rafael Espindola f1d598c2f6 Try to fix the build in some bots.
llvm-svn: 260736
2016-02-12 21:17:10 +00:00