llvm-project/lld
Simon Atanasyan 649e4d328f [MIPS] Fix PLT entries generation in case of linking regular and microMIPS code
Currently LLD calls the `isMicroMips` routine to determine type of PLT entries
needs to be generated: regular or microMIPS. This routine checks ELF
header flags in the `FirstObj` to retrieve type of linked object files.
So if the first file does not contain microMIPS code, LLD will generate
PLT entries with regular (non-microMIPS) code only.

Ideally, if a PLT entry is referenced by microMIPS code only this entry
should contain microMIPS code, if a PLT entry is referenced by regular
code this entry should contain regular code. In a "mixed" case the PLT
entry can be either microMIPS or regular, but each "cross-mode-call" has
additional cost.

It's rather difficult to implement this ideal solution. But we can
assume that if there is an input object file with microMIPS code, the
most part of the code is microMIPS too. So we need to deduce type of PLT
entries based on finally calculated ELF header flags and do not check
only the first input object file.

This change implements this.
  - The `getMipsEFlags` renamed to the `calcMipsEFlags`. The function
    called from the `LinkerDriver::link`. Result is stored in
    the Configuration::MipsEFlags field.
  - The `isMicroMips` and `isMipsR6` routines access the `MipsEFlags`
    field to get and check calculated ELF flags.
  - New types of PLT records created when necessary.

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

llvm-svn: 314675
2017-10-02 14:56:41 +00:00
..
COFF [ICF] Include section contents in section hash values. 2017-10-02 01:21:07 +00:00
ELF [MIPS] Fix PLT entries generation in case of linking regular and microMIPS code 2017-10-02 14:56:41 +00:00
MinGW Accept not only --foo but also -foo. 2017-09-14 18:33:21 +00:00
cmake/modules [lld][cmake] Fix BUILD_SHARED_LIBS installation 2017-01-24 10:41:02 +00:00
docs Fix .rst formatting error. 2017-10-01 03:50:48 +00:00
include/lld LLD: Introduce a GNU LD style driver for COFF 2017-09-11 17:02:59 +00:00
lib [MACH-O] Fix the ASM code generated for __stub_helpers section 2017-08-24 23:51:40 +00:00
test [MIPS] Fix PLT entries generation in case of linking regular and microMIPS code 2017-10-02 14:56:41 +00:00
tools/lld LLD: Introduce a GNU LD style driver for COFF 2017-09-11 17:02:59 +00:00
unittests Move Object format code to lib/BinaryFormat. 2017-06-07 03:48:56 +00:00
.arcconfig Upgrade all the .arcconfigs to https. 2016-07-14 13:15:37 +00:00
.clang-format
.gitignore
CMakeLists.txt LLD: Introduce a GNU LD style driver for COFF 2017-09-11 17:02:59 +00:00
CODE_OWNERS.TXT
LICENSE.TXT Update copyright year to 2016. 2016-03-30 22:40:59 +00:00
README.md Test commit 2017-06-24 21:16:41 +00:00

README.md

LLVM Linker (lld)

This directory and its subdirectories contain source code for the LLVM Linker, a modular cross platform linker which is built as part of the LLVM compiler infrastructure project.

lld is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.