Skip to content

cmd/link: cgo symbols can fall outside race detector mapped memory on darwin #17065

Closed
@josharian

Description

@josharian
package main

// int ii[65537];
import "C"

var sink C.int

func main() {
    for i := range C.ii {
        sink = C.ii[i]
    }
}

panics on darwin when run under race detector. The problem is that ii is not grouped with other bss symbols.

See https://groups.google.com/forum/#!topic/golang-dev/UVBznzrj5S4 for much more discussion.

Possible fixes include (1) somehow getting the linked symbols organized correctly and (2) teaching the race detector to find all C symbols.

I'll send a CL with a disabled failing test shortly. I'd love help fixing this. I'm not even sure where to start.

cc @crawshaw @ianlancetaylor @mwhudson @dvyukov

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions