summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2014-11-06 05:53:10 +0000
committerSimon Atanasyan <simon@atanasyan.com>2014-11-06 05:53:10 +0000
commitb915d07a8e62839ca745a48fc54d2c7ed793ebcd (patch)
tree325a59a03a613970db9f69766b32611b0e8f0d5c /lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
parent4c6bd6a10d06be042837df9004d7a5afc5ebca70 (diff)
downloadbcm5719-llvm-b915d07a8e62839ca745a48fc54d2c7ed793ebcd.tar.gz
bcm5719-llvm-b915d07a8e62839ca745a48fc54d2c7ed793ebcd.zip
[Mips] Check ELF flags to prevent linking of incompatible files
1. The path checks ELF header flags to prevent linking of incompatible files. For example we do not allow to link files with different ABI, -mnan flags, some combination of target CPU etc. 2. The patch merge ELF header flags from input object files to put their combination to the generated file. For example, if some input files have EF_MIPS_NOREORDER flag we need to put this flag to the output file header. I use the `parseFile()` (not `canParse()`) method because in case of recognition of incorrect input flags combination we should show detailed error message and stop the linking process and should not try to use another `Reader`. llvm-svn: 221439
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h')
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h b/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
index a34d6d0d065..29b4cd6afc8 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h
@@ -10,6 +10,7 @@
#define LLD_READER_WRITER_ELF_MIPS_MIPS_TARGET_HANDLER_H
#include "DefaultTargetHandler.h"
+#include "MipsELFFlagsMerger.h"
#include "MipsELFReader.h"
#include "MipsLinkingContext.h"
#include "MipsRelocationHandler.h"
@@ -108,11 +109,13 @@ public:
}
std::unique_ptr<Reader> getObjReader(bool atomizeStrings) override {
- return std::unique_ptr<Reader>(new MipsELFObjectReader(atomizeStrings));
+ return std::unique_ptr<Reader>(
+ new MipsELFObjectReader(_elfFlagsMerger, atomizeStrings));
}
std::unique_ptr<Reader> getDSOReader(bool useShlibUndefines) override {
- return std::unique_ptr<Reader>(new MipsELFDSOReader(useShlibUndefines));
+ return std::unique_ptr<Reader>(
+ new MipsELFDSOReader(_elfFlagsMerger, useShlibUndefines));
}
const MipsTargetRelocationHandler &getRelocationHandler() const override {
@@ -126,6 +129,7 @@ public:
private:
static const Registry::KindStrings kindStrings[];
MipsLinkingContext &_ctx;
+ MipsELFFlagsMerger _elfFlagsMerger;
std::unique_ptr<MipsRuntimeFile<Mips32ElELFType>> _runtimeFile;
std::unique_ptr<MipsTargetLayout<Mips32ElELFType>> _targetLayout;
std::unique_ptr<MipsTargetRelocationHandler> _relocationHandler;
OpenPOWER on IntegriCloud