mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 19:44:38 +08:00
Add a comment for retpoline PLT.
llvm-svn: 333312
This commit is contained in:
@@ -461,6 +461,15 @@ void X86_64<ELFT>::relaxGot(uint8_t *Loc, uint64_t Val) const {
|
||||
write32le(Loc - 1, Val + 1);
|
||||
}
|
||||
|
||||
// These nonstandard PLT entries are to migtigate Spectre v2 security
|
||||
// vulnerability. In order to mitigate Spectre v2, we want to avoid indirect
|
||||
// branch instructions such as `jmp *GOTPLT(%rip)`. So, in the following PLT
|
||||
// entries, we use a CALL followed by MOV and RET to do the same thing as an
|
||||
// indirect jump. That instruction sequence is so-called "retpoline".
|
||||
//
|
||||
// We have two types of retpoline PLTs as a size optimization. If `-z now`
|
||||
// is specified, all dynamic symbols are resolved at load-time. Thus, when
|
||||
// that option is given, we can omit code for symbol lazy resolution.
|
||||
namespace {
|
||||
template <class ELFT> class Retpoline : public X86_64<ELFT> {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user