Skip to content

linker error using zig cc with Go tests using race detection (again, __popcountdi2 not defined) #14989

@misha-ridge

Description

@misha-ridge

Zig Version

0.11.0-dev.1987+a2c6ecd6d

Steps to Reproduce and Observed Behavior

I'm not sure it's not a Go bug again, so please help me investigate.

CC='zig cc' go test -race . fails for me in master build with the failure different from #11398:

# pkg.test
runtime/race/internal/amd64v1(.text): relocation target __popcountdi2 not defined

This is with Go 1.20.1 that includes fix for golang/go#52690

This symbol is present in Go repository in a single file: src/runtime/race/internal/amd64v1/race_linux.syso. Indeed, bumping version of amd64 ISA using GOAMD64=v3 makes this problem disappear.

The repository with reproducer (using Docker to make sure no host libraries can be accidentally linked): https://github.com/misha-ridge/zig-race-test-repo, just clone and docker build . to reproduce.

Expected Behavior

CC='zig cc' go test -race . works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviordownstreamAn issue with a third party project that uses Zig.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions