-
Notifications
You must be signed in to change notification settings - Fork 10.7k
/
ARMLinkingContext.h
58 lines (47 loc) · 1.6 KB
/
ARMLinkingContext.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//===--------- lib/ReaderWriter/ELF/ARM/ARMLinkingContext.h ---------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_ELF_ARM_ARM_LINKING_CONTEXT_H
#define LLD_READER_WRITER_ELF_ARM_ARM_LINKING_CONTEXT_H
#include "lld/ReaderWriter/ELFLinkingContext.h"
#include "llvm/Object/ELF.h"
#include "llvm/Support/ELF.h"
namespace lld {
namespace elf {
class ARMLinkingContext final : public ELFLinkingContext {
public:
static std::unique_ptr<ELFLinkingContext> create(llvm::Triple);
ARMLinkingContext(llvm::Triple);
bool isRelaOutputFormat() const override { return false; }
void addPasses(PassManager &) override;
uint64_t getBaseAddress() const override {
if (_baseAddress == 0)
return 0x400000;
return _baseAddress;
}
bool isPLTRelocation(const Reference &r) const override {
if (r.kindNamespace() != Reference::KindNamespace::ELF)
return false;
assert(r.kindArch() == Reference::KindArch::ARM);
switch (r.kindValue()) {
case llvm::ELF::R_ARM_JUMP_SLOT:
case llvm::ELF::R_ARM_IRELATIVE:
return true;
default:
return false;
}
}
};
// Special methods to check code model of atoms.
bool isARMCode(const DefinedAtom *atom);
bool isARMCode(DefinedAtom::CodeModel codeModel);
bool isThumbCode(const DefinedAtom *atom);
bool isThumbCode(DefinedAtom::CodeModel codeModel);
} // end namespace elf
} // end namespace lld
#endif