diff --git a/cl/_testdata/llgotag/in.go b/cl/_testdata/llgotag/in.go new file mode 100644 index 00000000..82848674 --- /dev/null +++ b/cl/_testdata/llgotag/in.go @@ -0,0 +1,7 @@ +//go:build llgo +// +build llgo + +package llgotag + +func Foo() { +} diff --git a/cl/_testdata/llgotag/out.ll b/cl/_testdata/llgotag/out.ll new file mode 100644 index 00000000..6eadd8e5 --- /dev/null +++ b/cl/_testdata/llgotag/out.ll @@ -0,0 +1,22 @@ +; ModuleID = 'llgotag' +source_filename = "llgotag" + +@"llgotag.init$guard" = global i1 false, align 1 + +define void @llgotag.Foo() { +_llgo_0: + ret void +} + +define void @llgotag.init() { +_llgo_0: + %0 = load i1, ptr @"llgotag.init$guard", align 1 + br i1 %0, label %_llgo_2, label %_llgo_1 + +_llgo_1: ; preds = %_llgo_0 + store i1 true, ptr @"llgotag.init$guard", align 1 + br label %_llgo_2 + +_llgo_2: ; preds = %_llgo_1, %_llgo_0 + ret void +} diff --git a/internal/build/build.go b/internal/build/build.go index 557763ef..fd287419 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -121,6 +121,7 @@ const ( func Do(args []string, conf *Config) { flags, patterns, verbose := ParseArgs(args, buildFlags) + flags = append(flags, "-tags", "llgo") cfg := &packages.Config{ Mode: loadSyntax | packages.NeedDeps | packages.NeedModule | packages.NeedExportFile, BuildFlags: flags,