From 727d5f9ee1e86d3c1fae889f3d2de07f564634ed Mon Sep 17 00:00:00 2001 From: Yann Hodique Date: Sun, 20 Sep 2020 16:37:42 -0700 Subject: [PATCH] guard avo-generated assembly Regarding issue #19, fail in a more obvious way on non-gc toolchains by guarding the generated gc assembly. --- asm/gen.go | 3 +++ bdoor/bdoor_386.s | 2 ++ bdoor/bdoor_amd64.s | 2 ++ vmcheck/vmcheck_386.s | 2 ++ vmcheck/vmcheck_amd64.s | 2 ++ 5 files changed, 11 insertions(+) diff --git a/asm/gen.go b/asm/gen.go index 89e3c24..6cf356e 100644 --- a/asm/gen.go +++ b/asm/gen.go @@ -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" ) @@ -86,6 +87,8 @@ func GenAsm(f AvoMainFunc) { Arch: arch, } + ctx.Constraint(buildtags.Opt("gc")) + if err := f(ctx); err != nil { log.Fatal(err) } diff --git a/bdoor/bdoor_386.s b/bdoor/bdoor_386.s index 2858136..d75892f 100644 --- a/bdoor/bdoor_386.s +++ b/bdoor/bdoor_386.s @@ -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) diff --git a/bdoor/bdoor_amd64.s b/bdoor/bdoor_amd64.s index 109aa47..f35db27 100644 --- a/bdoor/bdoor_amd64.s +++ b/bdoor/bdoor_amd64.s @@ -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) diff --git a/vmcheck/vmcheck_386.s b/vmcheck/vmcheck_386.s index 88115af..ba08aad 100644 --- a/vmcheck/vmcheck_386.s +++ b/vmcheck/vmcheck_386.s @@ -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) diff --git a/vmcheck/vmcheck_amd64.s b/vmcheck/vmcheck_amd64.s index a4d374d..e05d81a 100644 --- a/vmcheck/vmcheck_amd64.s +++ b/vmcheck/vmcheck_amd64.s @@ -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)