1
hermetic_cc_toolchain/test/gorace/main.go
Motiejus Jakštys 9ce21b5276 [zig ld] --gc-sections workaround + tests
`zig cc` emits `--gc-sections` for the linker, which is incompatbile
with what CGo thinks about linking.

This commit adds a workaround: it will add `--no-gc-sections` to the
linking step if the command is not specified (falling back to the
default behavior of gcc/clang).

Related: https://github.com/golang/go/issues/52690
2022-05-05 13:36:58 +03:00

14 lines
400 B
Go

// Package main tests that Zig can compile race-enabled tests.
//
// As of writing, this fails:
// CGO_ENABLED=1 CC="zig cc" go test -race .
//
// More context: https://github.com/ziglang/zig/issues/11398
//
// This fails, because `zig cc` adds `--gc-sections` to the linker
// flag by default, which is incompatible with cgo. bazel-zig-cc
// adds a workaround for it.
package main
func main() {}