Skip to content

Commit

Permalink
cmd/asm: report an error when trying to do spectre on 386
Browse files Browse the repository at this point in the history
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 <[email protected]>
Run-TryBot: Keith Randall <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Bryan C. Mills <[email protected]>
  • Loading branch information
randall77 committed Oct 18, 2021
1 parent 74acbaf commit c091767
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cmd/internal/obj/x86/asm6.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c091767

Please sign in to comment.