|
LLVM 23.0.0git
|
Pass that replaces ret instructions with a jmp to __x86_return_thunk. More...
#include "X86.h"#include "X86InstrInfo.h"#include "X86Subtarget.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/StringRef.h"#include "llvm/CodeGen/MachineBasicBlock.h"#include "llvm/CodeGen/MachineFunction.h"#include "llvm/CodeGen/MachineFunctionPass.h"#include "llvm/CodeGen/MachineInstr.h"#include "llvm/CodeGen/MachineInstrBuilder.h"#include "llvm/CodeGen/MachineModuleInfo.h"#include "llvm/IR/Module.h"#include "llvm/MC/MCInstrDesc.h"#include "llvm/Support/Debug.h"#include "llvm/TargetParser/Triple.h"Go to the source code of this file.
Macros | |
| #define | PASS_KEY "x86-return-thunks" |
| #define | DEBUG_TYPE PASS_KEY |
Functions | |
| static bool | runX86ReturnThunks (MachineFunction &MF) |
| INITIALIZE_PASS (X86ReturnThunksLegacy, PASS_KEY, "X86 Return Thunks", false, false) FunctionPass *llvm | |
Variables | |
| constexpr StringRef | X86ReturnThunksPassName = "X86 Return Thunks" |
Pass that replaces ret instructions with a jmp to __x86_return_thunk.
This corresponds to -mfunction-return=thunk-extern or attribute((function_return("thunk-extern").
This pass is a minimal implementation necessary to help mitigate RetBleed for the Linux kernel.
Should support for thunk or thunk-inline be necessary in the future, then this pass should be combined with x86-retpoline-thunks which already has machinery to emit thunks. Until then, YAGNI.
This pass is very similar to x86-lvi-ret.
Definition in file X86ReturnThunks.cpp.
| #define DEBUG_TYPE PASS_KEY |
Definition at line 45 of file X86ReturnThunks.cpp.
| #define PASS_KEY "x86-return-thunks" |
Definition at line 44 of file X86ReturnThunks.cpp.
| INITIALIZE_PASS | ( | X86ReturnThunksLegacy | , |
| PASS_KEY | , | ||
| "X86 Return Thunks" | , | ||
| false | , | ||
| false | ) |
Definition at line 111 of file X86ReturnThunks.cpp.
References llvm::createX86ReturnThunksLegacyPass(), and PASS_KEY.
|
static |
Definition at line 60 of file X86ReturnThunks.cpp.
References llvm::MachineInstrBuilder::addExternalSymbol(), llvm::BuildMI(), llvm::StringRef::data(), llvm::dbgs(), llvm::MachineInstr::eraseFromParent(), llvm::MachineFunction::getFunction(), llvm::Module::getModuleFlag(), llvm::Value::getName(), llvm::GlobalValue::getParent(), llvm::MachineFunction::getSubtarget(), llvm::Function::hasFnAttribute(), LLVM_DEBUG, MBB, Modified, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and X86ReturnThunksPassName.
Referenced by llvm::X86ReturnThunksPass::run().
|
constexpr |
Definition at line 47 of file X86ReturnThunks.cpp.
Referenced by runX86ReturnThunks().