summaryrefslogtreecommitdiff
path: root/lld/ELF/Writer.h
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2017-10-02 14:56:41 +0000
committerSimon Atanasyan <simon@atanasyan.com>2017-10-02 14:56:41 +0000
commitb9813a10f2707c26225aac6935619b5c3defad41 (patch)
tree3b942058e263057f9b27c9463cec6fe96d0fed77 /lld/ELF/Writer.h
parent7742ccaf2bbbbf4257a4eabc999f227b1c988da0 (diff)
[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
Diffstat (limited to 'lld/ELF/Writer.h')
-rw-r--r--lld/ELF/Writer.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lld/ELF/Writer.h b/lld/ELF/Writer.h
index 83070005fcb..4db5fe8249e 100644
--- a/lld/ELF/Writer.h
+++ b/lld/ELF/Writer.h
@@ -48,7 +48,7 @@ struct PhdrEntry {
llvm::StringRef getOutputSectionName(llvm::StringRef Name);
-template <class ELFT> uint32_t getMipsEFlags();
+template <class ELFT> uint32_t calcMipsEFlags();
uint8_t getMipsFpAbiFlag(uint8_t OldFlag, uint8_t NewFlag,
llvm::StringRef FileName);