aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/InputSection.h
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/InputSection.h')
-rw-r--r--lld/ELF/InputSection.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h
index c7c8f45f432d..d1b889750bbd 100644
--- a/lld/ELF/InputSection.h
+++ b/lld/ELF/InputSection.h
@@ -10,7 +10,9 @@
#define LLD_ELF_INPUT_SECTION_H
#include "Relocations.h"
+#include "lld/Common/CommonLinkerContext.h"
#include "lld/Common/LLVM.h"
+#include "lld/Common/Memory.h"
#include "llvm/ADT/CachedHashString.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/TinyPtrVector.h"
@@ -97,6 +99,8 @@ protected:
link(link), info(info) {}
};
+struct RISCVRelaxAux;
+
// This corresponds to a section of an input file.
class InputSectionBase : public SectionBase {
public:
@@ -129,11 +133,10 @@ public:
return cast_or_null<ObjFile<ELFT>>(file);
}
- // If basic block sections are enabled, many code sections could end up with
- // one or two jump instructions at the end that could be relaxed to a smaller
- // instruction. The members below help trimming the trailing jump instruction
- // and shrinking a section.
- uint8_t bytesDropped = 0;
+ // Used by --optimize-bb-jumps and RISC-V linker relaxation temporarily to
+ // indicate the number of bytes which is not counted in the size. This should
+ // be reset to zero after uses.
+ uint16_t bytesDropped = 0;
// Whether the section needs to be padded with a NOP filler due to
// deleteFallThruJmpInsn.
@@ -201,11 +204,17 @@ public:
// This vector contains such "cooked" relocations.
SmallVector<Relocation, 0> relocations;
- // These are modifiers to jump instructions that are necessary when basic
- // block sections are enabled. Basic block sections creates opportunities to
- // relax jump instructions at basic block boundaries after reordering the
- // basic blocks.
- JumpInstrMod *jumpInstrMod = nullptr;
+ union {
+ // These are modifiers to jump instructions that are necessary when basic
+ // block sections are enabled. Basic block sections creates opportunities
+ // to relax jump instructions at basic block boundaries after reordering the
+ // basic blocks.
+ JumpInstrMod *jumpInstrMod = nullptr;
+
+ // Auxiliary information for RISC-V linker relaxation. RISC-V does not use
+ // jumpInstrMod.
+ RISCVRelaxAux *relaxAux;
+ };
// A function compiled with -fsplit-stack calling a function
// compiled without -fsplit-stack needs its prologue adjusted. Find