diff options
| author | Russ Cox <rsc@golang.org> | 2020-01-17 13:54:30 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2020-03-13 19:05:54 +0000 |
| commit | fc8a6336d1ad29acf2c7728ce669df9059169132 (patch) | |
| tree | 4121580d23be8c08aa0a7b0077254035ecb4473b /src/cmd/internal/obj/mips | |
| parent | 877ef86bec593cd7e40899ac5446791e65b47839 (diff) | |
| download | go-fc8a6336d1ad29acf2c7728ce669df9059169132.tar.xz | |
cmd/asm, cmd/compile, runtime: add -spectre=ret mode
This commit extends the -spectre flag to cmd/asm and adds
a new Spectre mitigation mode "ret", which enables the use
of retpolines.
Retpolines prevent speculation about the target of an indirect
jump or call and are described in more detail here:
https://support.google.com/faqs/answer/7625886
Change-Id: I4f2cb982fa94e44d91e49bd98974fd125619c93a
Reviewed-on: https://go-review.googlesource.com/c/go/+/222661
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/internal/obj/mips')
| -rw-r--r-- | src/cmd/internal/obj/mips/asm0.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/internal/obj/mips/asm0.go b/src/cmd/internal/obj/mips/asm0.go index c19541522f..5bbcb01444 100644 --- a/src/cmd/internal/obj/mips/asm0.go +++ b/src/cmd/internal/obj/mips/asm0.go @@ -402,6 +402,11 @@ var oprange [ALAST & obj.AMask][]Optab var xcmp [C_NCLASS][C_NCLASS]bool func span0(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { + if ctxt.Retpoline { + ctxt.Diag("-spectre=ret not supported on mips") + ctxt.Retpoline = false // don't keep printing + } + p := cursym.Func.Text if p == nil || p.Link == nil { // handle external functions and ELF section symbols return |
