diff options
author | Keith Randall <khr@golang.org> | 2021-10-15 13:52:05 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2021-10-18 15:54:41 +0000 |
commit | c091767d87b7a6ef6016286bc0fae8add59b92de (patch) | |
tree | 5497a91ebf11dcb688f8126ddfa12efd2ebb202b /src/cmd/internal | |
parent | 74acbaf94ab3c7aaa7e22fda4f90920e90f11ead (diff) | |
download | go-c091767d87b7a6ef6016286bc0fae8add59b92de.tar.gz go-c091767d87b7a6ef6016286bc0fae8add59b92de.zip |
cmd/asm: report an error when trying to do spectre on 386
The compiler refuses to do spectre mitigation on 386, but the
assembler doesn't. Fix that.
Fixes #49006
Change-Id: I887b6f7ed7523a47f463706f06ca4c2c6e828b6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/356190
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/internal')
-rw-r--r-- | src/cmd/internal/obj/x86/asm6.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/internal/obj/x86/asm6.go b/src/cmd/internal/obj/x86/asm6.go index 43ce832b17..6555756fd3 100644 --- a/src/cmd/internal/obj/x86/asm6.go +++ b/src/cmd/internal/obj/x86/asm6.go @@ -2035,6 +2035,11 @@ type nopPad struct { } func span6(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) { + if ctxt.Retpoline && ctxt.Arch.Family == sys.I386 { + ctxt.Diag("-spectre=ret not supported on 386") + ctxt.Retpoline = false // don't keep printing + } + pjc := makePjcCtx(ctxt) if s.P != nil { |