Skip to content

Commit

Permalink
guard avo-generated assembly
Browse files Browse the repository at this point in the history
Regarding issue vmware-archive#19, fail in a more obvious way on non-gc toolchains by guarding
the generated gc assembly.
  • Loading branch information
sigma authored and frapposelli committed Oct 6, 2021
1 parent 1edadea commit 727d5f9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions asm/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"os"

"github.com/mmcloughlin/avo/build"
"github.com/mmcloughlin/avo/buildtags"
"github.com/mmcloughlin/avo/gotypes"
"github.com/mmcloughlin/avo/ir"
)
Expand Down Expand Up @@ -86,6 +87,8 @@ func GenAsm(f AvoMainFunc) {
Arch: arch,
}

ctx.Constraint(buildtags.Opt("gc"))

if err := f(ctx); err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 2 additions & 0 deletions bdoor/bdoor_386.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Code generated by command: go run asm.go -out bdoor_386.s -arch 386. DO NOT EDIT.

// +build gc

#include "textflag.h"

// func bdoor_inout(ax uint32, bx uint32, cx uint32, dx uint32, si uint32, di uint32, bp uint32) (retax uint32, retbx uint32, retcx uint32, retdx uint32, retsi uint32, retdi uint32, retbp uint32)
Expand Down
2 changes: 2 additions & 0 deletions bdoor/bdoor_amd64.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Code generated by command: go run asm.go -out bdoor_amd64.s -arch amd64. DO NOT EDIT.

// +build gc

#include "textflag.h"

// func bdoor_inout(ax uint64, bx uint64, cx uint64, dx uint64, si uint64, di uint64, bp uint64) (retax uint64, retbx uint64, retcx uint64, retdx uint64, retsi uint64, retdi uint64, retbp uint64)
Expand Down
2 changes: 2 additions & 0 deletions vmcheck/vmcheck_386.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Code generated by command: go run asm.go -out vmcheck_386.s -arch 386. DO NOT EDIT.

// +build gc

#include "textflag.h"

// func cpuid_low(arg1 uint32, arg2 uint32) (eax uint32, ebx uint32, ecx uint32, edx uint32)
Expand Down
2 changes: 2 additions & 0 deletions vmcheck/vmcheck_amd64.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Code generated by command: go run asm.go -out vmcheck_amd64.s -arch amd64. DO NOT EDIT.

// +build gc

#include "textflag.h"

// func cpuid_low(arg1 uint32, arg2 uint32) (eax uint32, ebx uint32, ecx uint32, edx uint32)
Expand Down

0 comments on commit 727d5f9

Please sign in to comment.