Skip to content

cmd/link: -race doesn't work by default on FreeBSD with cgo #73788

Open
@prattmic

Description

@prattmic

On our freebsd-amd64 builders (14.2-RELEASE-p2):

package main

/*
int foo(void) { return 42; }
*/
import "C"
import "fmt"

func main() {
        fmt.Println(C.foo())
}
$ go build cgo.go
$ ./cgo
42
$ go build -race cgo.go
$ ./cgo
This sanitizer is not compatible with enabled ASLR and binaries compiled with PIE
$ go build -race -ldflags=-linkmode=internal cgo.go
$ ./cgo
42

i.e., using cgo defaults to external linking, but it seems that external linking breaks -race mode.

cc @golang/freebsd

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.OS-FreeBSDcompiler/runtimeIssues related to the Go compiler and/or runtime.help wanted

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions