Commit Graph

8155 Commits

Author SHA1 Message Date
Rui Ueyama a2f63f1471 Remove MIPS-specific code from computeAddend.
Previously, computeAddend had many parameters but most of them were
used only for MIPS. The MIPS ABI is too odd that I don't want to mix
it into the regular code path. Splitting the function into non-MIPS
and MIPS parts makes the regular code path easy to follow.

llvm-svn: 298817
2017-03-26 19:35:24 +00:00
Rui Ueyama 09fd21f45c Do not use assert to report broken input files.
llvm-svn: 298815
2017-03-26 18:23:22 +00:00
Rui Ueyama 8d462b2b5f Update comments.
llvm-svn: 298814
2017-03-26 18:23:00 +00:00
Rui Ueyama ff524bf739 Sort. NFC.
llvm-svn: 298797
2017-03-26 04:10:43 +00:00
Rui Ueyama f7c2b0cb49 Remove a redundant local variable.
llvm-svn: 298796
2017-03-26 03:42:00 +00:00
Rui Ueyama a588b5fcdc Add a comment.
llvm-svn: 298795
2017-03-26 03:41:41 +00:00
Rui Ueyama 2bb35f6844 Inline a function that is used only once.
llvm-svn: 298794
2017-03-26 03:21:08 +00:00
Rui Ueyama 94e36c894e De-template a few functions in which ELFT is not needed.
llvm-svn: 298793
2017-03-26 03:20:49 +00:00
Rui Ueyama 760197cef1 Add comments and return early.
llvm-svn: 298792
2017-03-26 03:20:30 +00:00
Rui Ueyama beeab45770 Remove unused parameter.
llvm-svn: 298790
2017-03-26 02:28:09 +00:00
Rui Ueyama cb815ac549 Remove redundant local variables.
llvm-svn: 298789
2017-03-26 02:27:50 +00:00
Rui Ueyama b5cb328383 Remove a parameter from adjustExpr. NFC.
llvm-svn: 298788
2017-03-26 02:27:30 +00:00
Rui Ueyama dfd204fa1d Inline a small lambda.
llvm-svn: 298787
2017-03-26 02:27:11 +00:00
Rui Ueyama 2f274230f1 Rename C -> Sec and RI -> Rel.
C is short for Chunk, but we are no longer using that term.
RI is probably short for relocation iterator, but this is not an interator.

llvm-svn: 298786
2017-03-26 02:26:52 +00:00
Rui Ueyama 08aede362b Simplify relocation offset adjustment.
Previously, relocation offsets are recalculated for .eh_frame sections
inside the main loop, and that messed up the main loop. This patch
separates that logic into a dedicated class.

llvm-svn: 298785
2017-03-26 02:26:33 +00:00
Rui Ueyama 22f0d804f5 Use raw_fd_ostream::has_colors instead of StandardErrHasColors().
I just didn't know that raw_fd_ostream has has_colors() function.

llvm-svn: 298749
2017-03-24 23:21:34 +00:00
Rui Ueyama 561d72c328 Update comment.
llvm-svn: 298748
2017-03-24 23:21:14 +00:00
Reid Kleckner 5d57752c81 [PDB] Split item and type records when merging type streams
Summary: MSVC does this when producing a PDB.

Reviewers: ruiu

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31316

llvm-svn: 298717
2017-03-24 17:26:38 +00:00
Rui Ueyama c3ddb655cc Return early.
llvm-svn: 298675
2017-03-24 01:13:30 +00:00
Rui Ueyama 2c88cee15c Early continue. NFC.
The original code is a big `if` and `else` which ends with `continue`
like this:

  if (cond) {
    ...
    // fall through
  } else {
    ...
    continue;
  }

This patch rewrites it with the following.

  if (!cond) {
    ...
    continue;
  }
  ...

llvm-svn: 298672
2017-03-24 00:50:37 +00:00
Rui Ueyama 81cb710784 Update comments.
llvm-svn: 298669
2017-03-24 00:15:57 +00:00
Rui Ueyama be68fe18cc Use `using namespace lld` for consistency with other files.
llvm-svn: 298668
2017-03-24 00:15:37 +00:00
Rui Ueyama 9b55e92a7f Move a few functions to a new file Filesystem.{cpp,h}.
llvm-svn: 298667
2017-03-24 00:15:16 +00:00
Rui Ueyama 0cbf1fd2f6 Fix varaible names that correspond to command line options.
llvm-svn: 298632
2017-03-23 18:16:42 +00:00
Simon Atanasyan 6ab0d5b0d1 [ELF] Print two more MIPS targets "supported" by LLD
These targets are related to MIPS N32 ABI.

llvm-svn: 298591
2017-03-23 12:17:32 +00:00
Petr Hosek 30f16b2339 [ELF] Allow references to reserved symbols in linker scripts
This requires collectign all symbols referenced in the linker script
and adding them to symbol table as undefined symbol.

Differential Revision: https://reviews.llvm.org/D31147

llvm-svn: 298577
2017-03-23 03:52:34 +00:00
Rui Ueyama 968381ef22 Simplify. No functionality change intended.
I honestly do not understand this part of code as it is too tangled.
What I'm trying now is to carefully disentangle it by transforming
code without changing meaining to see if I can improve overall
readability.

llvm-svn: 298576
2017-03-23 03:44:08 +00:00
Rui Ueyama ccf71c6ab3 Remove unnecessary local variable.
llvm-svn: 298575
2017-03-23 03:11:03 +00:00
Rui Ueyama 688299bd39 Refine comment.
llvm-svn: 298571
2017-03-23 01:19:10 +00:00
Rui Ueyama 4372c38a72 Fix Windows buildbots.
llvm-svn: 298570
2017-03-23 01:16:57 +00:00
Rui Ueyama 34e3d50d18 Force @{init,fini}_array if section name starts with ".{init,fini}_array.".
Fixes https://bugs.llvm.org/show_bug.cgi?id=32307.

Differential Revision: https://reviews.llvm.org/D31255

llvm-svn: 298569
2017-03-23 01:00:41 +00:00
Rui Ueyama b57412e95d Print out "suppoted targets".
This is to improve compatibility with GNU Libtool that expect
/supported targets:.* elf/ in a message for the -help option.

Differential Revision: https://reviews.llvm.org/D31208

llvm-svn: 298568
2017-03-23 01:00:22 +00:00
Davide Italiano 7690721153 [ELF] Add -z nodlopen option.
Patch by Mark Kettenis.

llvm-svn: 298567
2017-03-23 00:54:16 +00:00
Rui Ueyama 4995afd943 Rename forEach -> parallelForEach and forLoop -> parallelFor.
"Parallel" is the most important aspect of the functions,
so we shouldn't omit that.

llvm-svn: 298557
2017-03-22 23:03:35 +00:00
Reid Kleckner 77d3aa476e Add a /nopdb flag to disable PDB generation
This will be used in the sanitizer test suite, which wants to use DWARF
line tables.

At some point we should reconsider how LLD handles the long section
names required by DWARF debug sections.

llvm-svn: 298544
2017-03-22 19:49:12 +00:00
Rui Ueyama bdc8bc047d Add "(compatible with GNU linkers)" to the -version output.
Previous output:

  $ ld.lld -version
  LLD 5.0.0

New output:

  $ ld.lld -version
  LLD 5.0.0 (compatible with GNU linkers)

Differential Revision: https://reviews.llvm.org/D31199

llvm-svn: 298532
2017-03-22 18:04:57 +00:00
Reid Kleckner 3a0dea5243 Update LLD tests for codeview dumping changes
llvm-svn: 298475
2017-03-22 01:43:49 +00:00
Reid Kleckner 13bdbfb622 [COFF] Put the PDB next to the image if the user doesn't pass /PDB:
Summary: This is compatible with MSVC link.exe.

Reviewers: ruiu

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31224

llvm-svn: 298467
2017-03-22 00:57:14 +00:00
Rui Ueyama 7ab38c3a12 Define Config::Is64.
This is a shorthand for Config->Wordsize == 8. So this is not strictly
necessary but seems handy. "Is 64 bit?" is easier to read than "Is
wordsize 8 byte?"

llvm-svn: 298463
2017-03-22 00:01:11 +00:00
Rui Ueyama a34da93847 Make elf::ScriptConfig a LinkerScript class member variable.
LinkerScript used to be a template class, so we couldn't instantiate
that class in elf::link. We instantiated ScriptConfig class earlier
instead so that the linker script parser can store configurations to
the object.

Now that LinkerScript is not a template, it doesn't make sense to
separate ScriptConfig from LinkerScript. This patch merges them.

llvm-svn: 298457
2017-03-21 23:03:09 +00:00
Rui Ueyama b8dd23f56e Rename LinkerScriptBase -> LinkerScript.
llvm-svn: 298456
2017-03-21 23:02:51 +00:00
Rui Ueyama fc16173ceb Sort. NFC.
llvm-svn: 298447
2017-03-21 21:49:16 +00:00
Rui Ueyama f93ed4de2e Define Config::Endianness.
This is a shorthand for `Config->IsLE ? support::little : support::big`.

llvm-svn: 298445
2017-03-21 21:40:08 +00:00
Rui Ueyama ca7818ebca Update comment.
llvm-svn: 298403
2017-03-21 17:22:13 +00:00
George Rimar 1ec03e46a7 [ELF] - Detemplate InputSection::getRelocatedSection(). NFC.
llvm-svn: 298353
2017-03-21 09:13:27 +00:00
George Rimar 76e562ab1b [ELF] - Detemplate InputSectionBase::uncompress(). NFC
llvm-svn: 298351
2017-03-21 09:08:58 +00:00
George Rimar 90a528ba7a [ELF] - Detemplate ARMExidxSentinelSection. NFC.
llvm-svn: 298350
2017-03-21 09:01:39 +00:00
George Rimar f56cadd3b3 [ELF] - Fix one more access to Sections member.
That finally should linux BB after r298345.

llvm-svn: 298349
2017-03-21 08:57:13 +00:00
George Rimar 3f7c3df6a4 [ELF] Follow-up to r298345 "[ELF] - Detemplate GdbIndexSection."
Fix for linux build bot:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/8144/steps/build/logs/stdio

llvm-svn: 298348
2017-03-21 08:44:25 +00:00
George Rimar 9353e2dbfb [ELF] - Detemplate InputSectionBase::getLinkOrderDep(). NFC.
llvm-svn: 298346
2017-03-21 08:29:48 +00:00