Commit Graph

12523 Commits

Author SHA1 Message Date
James Clarke 1ab27c74d4 [lld][WebAssembly] Fix static linking of -fPIC code with external undefined data
Reviewers: ruiu, sbc100

Reviewed By: sbc100

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

Tags: #llvm

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

llvm-svn: 374913
2019-10-15 17:05:42 +00:00
Sid Manning ab50256544 [lld] Check for branch range overflows.
Differential Revision: https://reviews.llvm.org/D68875

llvm-svn: 374891
2019-10-15 14:12:54 +00:00
Martin Storsjo e0916f4fbe [LLD] [COFF] Update a leftover comment after SVN r374869. NFC.
llvm-svn: 374874
2019-10-15 09:46:33 +00:00
Martin Storsjo cd8759c3c2 [LLD] [COFF] Fix -Wmissing-field-initializers warnings. NFC.
llvm-svn: 374873
2019-10-15 09:33:14 +00:00
Martin Storsjo 9318c94ebb [LLD] [COFF] Wrap file location pair<StringRef,int> in Optional<>. NFC.
This makes use of it slightly clearer, and makes it match the
same construct in the lld ELF linker.

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

llvm-svn: 374869
2019-10-15 09:18:18 +00:00
Jordan Rupprecht c526ff8a62 [llvm-objdump] Adjust spacing and field width for --section-headers
Summary:
- Expand the "Name" column past 13 characters when any of the section names are longer. Current behavior is a staggard output instead of a nice table if a single name is longer.
- Only print the required number of hex chars for addresses (i.e. 8 characters for 32-bit, 16 characters for 64-bit)
- Fix trailing spaces

Reviewers: grimar, jhenderson, espindola

Reviewed By: grimar

Subscribers: emaste, sbc100, arichardson, aheejin, seiya, llvm-commits, MaskRay

Tags: #llvm

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

llvm-svn: 374795
2019-10-14 17:47:17 +00:00
George Rimar a8346cee8a [LLD][ELF] - Update test cases after llvm-readobj change.
https://reviews.llvm.org/D68704 changed the output format.

llvm-svn: 374542
2019-10-11 12:27:20 +00:00
Amy Huang c9428a04fc Change test case so that it accepts backslashes in file path, in the case that the test runs on Windows
llvm-svn: 374473
2019-10-10 23:35:53 +00:00
Zachary Turner 02c5386811 [PDB] Fix bug when using multiple PCH header objects with the same name.
A common pattern in Windows is to have all your precompiled headers
use an object named stdafx.obj.  If you've got a project with many
different static libs, you might use a separate PCH for each one of
these.

During the final link step, a file from A might reference the PCH
object from A, but it will have the same name (stdafx.obj) as any
other PCH from another project.  The only difference will be the
path.  For example, A might be A/stdafx.obj while B is B/stdafx.obj.

The existing algorithm checks only the filename that was passed on
the command line (or stored in archive), but this is insufficient in
the case where relative paths are used, because depending on the
command line object file / library order, it might find the wrong
PCH object first resulting in a signature mismatch.

The fix here is to simply check whether the absolute path of the
PCH object (which is stored in the input obj file for the file that
references the PCH) *ends with* the full relative path of whatever
is specified on the command line (or is in the archive).

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

llvm-svn: 374442
2019-10-10 20:25:51 +00:00
Russell Gallop 6d6ec1b869 [LLD][ELF] Fix stale comments about doing ICF
Differential Revision: https://reviews.llvm.org/D68396

llvm-svn: 374362
2019-10-10 14:50:02 +00:00
Rui Ueyama 9adea6e4fa Make nullptr check more robust
The only condition that isecLoc becomes null is

  Out::bufferStart == nullptr,
  isec->getParent()->offset == 0, and
  isec->outSecOff == 0.

We can check the first condition only once.

llvm-svn: 374332
2019-10-10 12:41:08 +00:00
Roman Lebedev 1508fbad79 [lld] getErrPlace(): don't perform arithmetics on maybe-null pointer
isecLoc there can be null, but at the same time isec->getSize() may
be non-null. It is UB to offset a nullptr.The most straight-forward fix
here appears to perform casts+normal integral arithmetics.

FAIL: lld :: ELF/invalid/invalid-relocation-aarch64.test (1158 of 2217)
******************** TEST 'lld :: ELF/invalid/invalid-relocation-aarch64.test' FAILED ********************
Script:
--
: 'RUN: at line 2';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/yaml2obj /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-aarch64.test -o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-aarch64.test.tmp.o
: 'RUN: at line 3';   not /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld.lld /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-aarch64.test.tmp.o -o /dev/null 2>&1 | /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-aarch64.test
--
Exit Code: 1

Command Output (stderr):
--
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-aarch64.test:4:10: error: CHECK: expected string not found in input
# CHECK: error: unknown relocation (1024) against symbol foo
         ^
<stdin>:1:1: note: scanning from here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp💯41: runtime error: applying non-zero offset 24 to null pointer
^
<stdin>:1:118: note: possible intended match here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp💯41: runtime error: applying non-zero offset 24 to null pointer
                                                                                                                     ^

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.
FAIL: lld :: ELF/invalid/invalid-relocation-x64.test (1270 of 2217)
******************** TEST 'lld :: ELF/invalid/invalid-relocation-x64.test' FAILED ********************
Script:
--
: 'RUN: at line 2';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/yaml2obj /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-x64.test -o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp1.o
: 'RUN: at line 3';   echo ".global foo; foo:" > /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.s
: 'RUN: at line 4';   /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/llvm-mc /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.s -o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.o -filetype=obj -triple x86_64-pc-linux
: 'RUN: at line 5';   not /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/ld.lld /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp1.o /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/tools/lld/test/ELF/invalid/Output/invalid-relocation-x64.test.tmp2.o -o /dev/null 2>&1 | /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build_ubsan/bin/FileCheck /b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-x64.test
--
Exit Code: 1

Command Output (stderr):
--
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/test/ELF/invalid/invalid-relocation-x64.test:6:10: error: CHECK: expected string not found in input
# CHECK: error: unknown relocation (152) against symbol foo
         ^
<stdin>:1:1: note: scanning from here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp💯41: runtime error: applying non-zero offset 24 to null pointer
^
<stdin>:1:118: note: possible intended match here
/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/lld/ELF/Target.cpp💯41: runtime error: applying non-zero offset 24 to null pointer
                                                                                                                     ^

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 20.73s
********************
Failing Tests (2):
    lld :: ELF/invalid/invalid-relocation-aarch64.test
    lld :: ELF/invalid/invalid-relocation-x64.test

llvm-svn: 374329
2019-10-10 12:22:55 +00:00
Fangrui Song d79c3be618 [COFF] Wrap definitions in namespace lld { namespace coff {. NFC
Similar to D67323, but for COFF. Many lld/COFF/ files already use
`namespace lld { namespace coff {`. Only a few need changing.

Reviewed By: ruiu

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

llvm-svn: 374314
2019-10-10 11:27:58 +00:00
Rui Ueyama 37bf9bb405 Use error instead of fatal to report usage errors
Differential Revision: https://reviews.llvm.org/D68768

llvm-svn: 374297
2019-10-10 09:46:41 +00:00
Martin Storsjo 0226c35262 [LLD] [MinGW] Look for other library patterns with -l
GNU ld looks for a number of other patterns than just lib<name>.dll.a
and lib<name>.a.

GNU ld does support linking directly against a DLL without using an
import library. If that's the only match for a -l argument, point out
that the user needs to use an import library, instead of leaving the
user with a puzzling message about the -l argument not being found
at all.

Also convert an existing case of fatal() into error().

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

llvm-svn: 374292
2019-10-10 08:52:39 +00:00
Martin Storsjo e742794ffa [LLD] [MinGW] Add a testcase for -l:name style library options. NFC.
Differential Revision: https://reviews.llvm.org/D68688

llvm-svn: 374291
2019-10-10 08:52:31 +00:00
Rui Ueyama d7ead5b58d Improve error message for bad SHF_MERGE sections
This patch adds a section name to error messages.

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

llvm-svn: 374290
2019-10-10 08:32:12 +00:00
Fangrui Song 33c59abf5c [WebAssembly] Wrap definitions in namespace lld { namespace wasm {. NFC
Similar to D68323, but for wasm.

Reviewed By: ruiu

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

llvm-svn: 374279
2019-10-10 05:25:39 +00:00
Sam Clegg ad2e12a3d9 [lld][WebAssembly] Refactor markLive.cpp. NFC
This pattern matches the ELF implementation add if also useful as
part of a planned change where running `mark` more than once is needed.

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

llvm-svn: 374275
2019-10-10 03:23:06 +00:00
Nico Weber 79a8476d43 dummy comment typo fix commit to cycle the bots
llvm-svn: 374270
2019-10-10 02:04:56 +00:00
Hans Wennborg 1e1e3ba252 Unify the two CRC implementations
David added the JamCRC implementation in r246590. More recently, Eugene
added a CRC-32 implementation in r357901, which falls back to zlib's
crc32 function if present.

These checksums are essentially the same, so having multiple
implementations seems unnecessary. This replaces the CRC-32
implementation with the simpler one from JamCRC, and implements the
JamCRC interface in terms of CRC-32 since this means it can use zlib's
implementation when available, saving a few bytes and potentially making
it faster.

JamCRC took an ArrayRef<char> argument, and CRC-32 took a StringRef.
This patch changes it to ArrayRef<uint8_t> which I think is the best
choice, and simplifies a few of the callers nicely.

Differential revision: https://reviews.llvm.org/D68570

llvm-svn: 374148
2019-10-09 09:06:30 +00:00
Rui Ueyama 07775b207a Use lld-link instead of llvm-dlltool to create an implib
Suggested by Martin Storsjö.

llvm-svn: 374142
2019-10-09 07:04:38 +00:00
Rui Ueyama c3c5e0fbbf [lld] Don't create hints-section if Hint/Name Table is empty
Fixes assert in addLinkerModuleCoffGroup() when using by-ordinal imports
only.

Patch by Stefan Schmidt.

Differential revision: https://reviews.llvm.org/D68352

llvm-svn: 374140
2019-10-09 06:48:24 +00:00
Sid Manning aca5d395d5 [lld][Hexagon] Support PLT relocation R_HEX_B15_PCREL_X/R_HEX_B9_PCREL_X
These are sometimes generated by tail call optimizations.

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

llvm-svn: 374052
2019-10-08 14:23:49 +00:00
Rui Ueyama d2e9dd3877 Use /dev/null for tests that we do not need outputs
llvm-svn: 374023
2019-10-08 08:03:44 +00:00
Rui Ueyama 5493366729 Report error if -export-dynamic is used with -r
The combination of the two flags doesn't make sense. And other linkers
seem to just ignore --export-dynamic if --relocatable is given, but
we probably should report it as an error to let users know that is
an invalid combination.

Fixes https://bugs.llvm.org/show_bug.cgi?id=43552

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

llvm-svn: 374022
2019-10-08 08:03:40 +00:00
Fangrui Song 24ec80425a [ELF][MIPS] De-template writeValue. NFC
Depends on D68561.

llvm-svn: 373886
2019-10-07 08:52:07 +00:00
Fangrui Song bd8cfe65f5 [ELF] Wrap things in `namespace lld { namespace elf {`, NFC
This makes it clear `ELF/**/*.cpp` files define things in the `lld::elf`
namespace and simplifies `elf::foo` to `foo`.

Reviewed By: atanasyan, grimar, ruiu

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

llvm-svn: 373885
2019-10-07 08:31:18 +00:00
Fangrui Song 5761e3cef4 [ELF][MIPS] Use lld:🧝:{read,write}* instead of llvm::support::endian::{read,write}*
This allows us to delete `using namespace llvm::support::endian` and
simplify D68323. This change adds runtime config->endianness check but
the overhead should be negligible.

Reviewed By: ruiu

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

llvm-svn: 373884
2019-10-07 08:30:46 +00:00
Martin Storsjo 9809ed6135 [LLD] [COFF] Always demangle the __imp_ prefix to __declspec(dllimport)
Differential Revision: https://reviews.llvm.org/D68017

llvm-svn: 373781
2019-10-04 19:47:59 +00:00
Martin Storsjo 4d1405ad87 Revert r371732: "lld-link: Fix tests that do not run on macOS after r371729."
This commit should be reverted along with r371729.

llvm-svn: 373713
2019-10-04 08:34:26 +00:00
Fangrui Song 7588cf09da [ELF] Use union-find set and doubly linked list in Call-Chain Clustering (C³) heuristic
Before, SecToClusters[*] was used to track the belonged cluster.
During a merge (From -> Into), every element of From has to be updated.
Use a union-find set to speed up this use case.

Also, replace `std::vector<int> Sections;` with a doubly-linked
pointers: int Next, Prev;

Reviewed By: Bigcheese

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

llvm-svn: 373708
2019-10-04 07:56:54 +00:00
Rui Ueyama e4758a5c27 [MinGW] Add --reproduce option
Differential Revision: https://reviews.llvm.org/D68382

llvm-svn: 373705
2019-10-04 07:27:45 +00:00
Rui Ueyama 0d53ac8096 Add /reproduce option to lld/COFF
This patch adds /reproduce:<path> option to lld/COFF. This is an
lld-specific option, so we can name it freely. I chose /reproduce
over other names (e.g. /lldlinkrepro) for consistency with other lld
ports.

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

llvm-svn: 373704
2019-10-04 07:27:38 +00:00
Rui Ueyama 6785824431 Revert r371729: lld-link: Make /linkrepro: take a filename, not a directory.
This reverts commit r371729 because /linkrepro option also exists
in Microsoft link.exe and their linker takes not a filename but a
directory name as an argument for /linkrepro.

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

llvm-svn: 373703
2019-10-04 07:27:31 +00:00
Jordan Rupprecht 9d4a6b1bb2 [llvm-objdump] Further rearrange llvm-objdump sections for compatability
Summary:
rL371826 rearranged some output from llvm-objdump for GNU objdump compatability, but there still seem to be some more.

I think this rearrangement is a little closer. Overview of the ordering which matches GNU objdump:
* Archive headers
* File headers
* Section headers
* Symbol table
* Dwarf debugging
* Relocations (if `--disassemble` is not used)
* Section contents
* Disassembly

Reviewers: jhenderson, justice_adams, grimar, ychen, espindola

Reviewed By: jhenderson

Subscribers: aprantl, emaste, arichardson, jrtc27, atanasyan, seiya, llvm-commits, MaskRay

Tags: #llvm

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

llvm-svn: 373671
2019-10-03 22:01:08 +00:00
Simon Atanasyan afe7197f13 [mips] Use llvm-readobj `-A` flag in test cases. NFC
llvm-svn: 373589
2019-10-03 12:08:04 +00:00
Peter Collingbourne 42ec0b777f Add missing REQUIRES: arm.
llvm-svn: 373357
2019-10-01 17:35:56 +00:00
Peter Collingbourne 0bb825d208 ELF: Add .interp synthetic sections first in createSyntheticSections().
Our .interp section is not a SyntheticSection. As a result, it terminates the
loop in removeUnusedSyntheticSections(). This has at least two consequences:

- The synthetic .bss and .bss.rel.ro sections are always present in
  dynamically linked executables, even when they are not needed.
- The synthetic .ARM.exidx (and possibly other) sections are always present
  in partitions other than the last one, even when not needed.
  .ARM.exidx in particular is problematic because it assumes that its
  list of code sections is non-empty in getLinkOrderDep(), which can
  lead to a crash if the partition does not have any code sections.

Fix these problems by moving the creation of the .interp sections to the
top of createSyntheticSections(). While here, make the code a little less
error-prone by changing the add() lambdas to take a SyntheticSection instead
of an InputSectionBase.

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

llvm-svn: 373347
2019-10-01 16:10:13 +00:00
Peter Collingbourne 97e251e05a ELF: Don't merge SHF_LINK_ORDER sections for different output sections in relocatable links.
Merging SHF_LINK_ORDER sections can affect semantics if the sh_link
fields point to different sections.

Specifically, for SHF_LINK_ORDER sections, the sh_link field acts as a reverse
dependency from the linked section, causing the SHF_LINK_ORDER section to
be included if the linked section is included. Merging sections with different
sh_link fields will cause the entire contents of the SHF_LINK_ORDER section
to be associated with a single (arbitrarily chosen) output section, whereas the
correct semantics are for the individual pieces of the SHF_LINK_ORDER section
to be associated with their linked output sections. As a result we can end up
incorrectly dropping SHF_LINK_ORDER section contents or including the wrong
section contents, depending on which linked sections were chosen.

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

llvm-svn: 373255
2019-09-30 20:23:00 +00:00
Nico Weber 2331cd69cd Revert "[MC] Emit unused undefined symbol even if its binding is not set"
This reverts r373168. It caused PR43511.

llvm-svn: 373242
2019-09-30 18:13:48 +00:00
Fangrui Song 4006434ed1 [ELF][test] Change llvm-readobj --arm-attributes to --arch-specific after r373125
llvm-svn: 373178
2019-09-30 04:24:35 +00:00
Fangrui Song c513360662 [MC] Emit unused undefined symbol even if its binding is not set
For the following two cases, we currently suppress the symbols. This
patch emits them (compatible with GNU as).

* `test2_a = undef`: if `undef` is otherwise unused.
* `.hidden hidden`: if `hidden` is unused. This is the main point of the
  patch, because omitting the symbol would cause a linker semantic
  difference.

It causes a behavior change that is not compatible with GNU as:

.weakref foo1, bar1

When neither foo1 nor bar1 is used, we now emit bar1, which is arguably
more consistent.

Another change is that we will emit .TOC. for .TOC.@tocbase .  For this
directive, suppressing .TOC. can be seen as a size optimization, but we
choose to drop it for simplicity and consistency.

llvm-svn: 373168
2019-09-29 15:26:12 +00:00
Martin Storsjo ac7c6d554d [LLD] [test] Add a forgotten comment. NFC.
This was requested in https://reviews.llvm.org/D68014, but I forgot
to add it before pushing the commit.

llvm-svn: 373145
2019-09-28 09:51:02 +00:00
Martin Storsjo 5ebab1f8f9 [LLD] Simplify the demangleItanium function. NFC.
Instead of returning an optional, just return the input string if
demangling fails, as that's what all callers use anyway.

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

llvm-svn: 373077
2019-09-27 12:24:18 +00:00
Martin Storsjo dd71b2d4c3 [LLD] Convert demangleItanium to use the higher level llvm::demangle function. NFC.
This avoids a few lines of boilerplate of dealing with C string
allocations.

Add a testcase for a case where demangling shouldn't happen.

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

llvm-svn: 373076
2019-09-27 12:24:03 +00:00
Martin Storsjo bf6f4e9932 [LLD] [COFF] Use the unified llvm demangle frontend function. NFC.
Add test cases for some cases where we don't want demangling to happen.

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

llvm-svn: 373075
2019-09-27 12:23:45 +00:00
Fangrui Song f1e1451946 [ELF] Set SectionBase::partition in processSectionCommands
Fixes PR43461 (regression caused by D67504)

The partition field of a SECTIONS-specified section is not set after
D67504. The 0 value affects findSection() which checks if the partition
field is 1.

So `Out::initArray = findSection(".init_array")` is null, and
DT_INIT_ARRAYSZ is not set.

Reviewed By: peter.smith

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

llvm-svn: 372996
2019-09-26 17:10:09 +00:00
Matt Davis 4d17cdc704 [lld][mach-o] Avoid segfaulting when handling an empty section list.
Summary:
The following patch avoids segfaulting if the section list is empty when writing a mach-o MH_OBJECT.  I ran into this case from a more complicated example trying to dead_strip while using '-r' in lld.

I'm not sure if having empty sections is a legal mach-o, but it does seem that other llvm-binutils tools can ingest such a boring object with out issue.  Would it be better to emit an error, emit a warning, or do nothing?  It seems that adding a warning diagnostic might be helpful to users, as I did not expect to have a section-less object when the linker was done.

Reviewers: kledzik, ruiu

Subscribers: llvm-commits, jrm

Tags: #lld, #llvm

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

llvm-svn: 372995
2019-09-26 17:03:20 +00:00
Simon Atanasyan fba48fcf44 [mips] Relax jalr/jr instructions using R_MIPS_JALR relocation
The R_MIPS_JALR relocation denotes jalr/jr instructions in position
independent code. Both these instructions take a target's address from
the $25 register. If offset to the target symbol fits into the 18-bits,
it's more efficient to replace jalr/jr by bal/b instructions.

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

llvm-svn: 372951
2019-09-26 09:13:20 +00:00