summaryrefslogtreecommitdiff
path: root/ELF/Thunks.h
diff options
context:
space:
mode:
Diffstat (limited to 'ELF/Thunks.h')
-rw-r--r--ELF/Thunks.h42
1 files changed, 22 insertions, 20 deletions
diff --git a/ELF/Thunks.h b/ELF/Thunks.h
index ed82b4d946ac2..2d27ee5f6c38e 100644
--- a/ELF/Thunks.h
+++ b/ELF/Thunks.h
@@ -1,9 +1,8 @@
//===- Thunks.h --------------------------------------------------------===//
//
-// The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -28,42 +27,45 @@ class ThunkSection;
// Thunks are assigned to synthetic ThunkSections
class Thunk {
public:
- Thunk(Symbol &Destination);
+ Thunk(Symbol &destination);
virtual ~Thunk();
virtual uint32_t size() = 0;
- virtual void writeTo(uint8_t *Buf) = 0;
+ virtual void writeTo(uint8_t *buf) = 0;
// All Thunks must define at least one symbol, known as the thunk target
// symbol, so that we can redirect relocations to it. The thunk may define
// additional symbols, but these are never targets for relocations.
- virtual void addSymbols(ThunkSection &IS) = 0;
+ virtual void addSymbols(ThunkSection &isec) = 0;
- void setOffset(uint64_t Offset);
- Defined *addSymbol(StringRef Name, uint8_t Type, uint64_t Value,
- InputSectionBase &Section);
+ void setOffset(uint64_t offset);
+ Defined *addSymbol(StringRef name, uint8_t type, uint64_t value,
+ InputSectionBase &section);
// Some Thunks must be placed immediately before their Target as they elide
// a branch and fall through to the first Symbol in the Target.
virtual InputSection *getTargetInputSection() const { return nullptr; }
- // To reuse a Thunk the caller as identified by the Type must be
- // compatible with it.
- virtual bool isCompatibleWith(RelType Type) const { return true; }
+ // To reuse a Thunk the InputSection and the relocation must be compatible
+ // with it.
+ virtual bool isCompatibleWith(const InputSection &,
+ const Relocation &) const {
+ return true;
+ }
- Defined *getThunkTargetSym() const { return Syms[0]; }
+ Defined *getThunkTargetSym() const { return syms[0]; }
// The alignment requirement for this Thunk, defaults to the size of the
// typical code section alignment.
- Symbol &Destination;
- llvm::SmallVector<Defined *, 3> Syms;
- uint64_t Offset = 0;
- uint32_t Alignment = 4;
+ Symbol &destination;
+ llvm::SmallVector<Defined *, 3> syms;
+ uint64_t offset = 0;
+ uint32_t alignment = 4;
};
// For a Relocation to symbol S create a Thunk to be added to a synthetic
-// ThunkSection. At present there are implementations for ARM and Mips Thunks.
-Thunk *addThunk(RelType Type, Symbol &S);
+// ThunkSection.
+Thunk *addThunk(const InputSection &isec, Relocation &rel);
} // namespace elf
} // namespace lld