Skip to content

cmd/go: "internal/abi" needs to be compiled with "-+" #45144

@mdempsky

Description

@mdempsky
Contributor

Packages that package runtime depends on are supposed to be compiled with -+ so the compiler knows to do some runtime-specific behavior. cmd/go has a hard-coded list of known packages that runtime depends on, but this wasn't updated when "internal/abi" was added:

compilingRuntime := p.Standard && (p.ImportPath == "runtime" || strings.HasPrefix(p.ImportPath, "runtime/internal"))
// The runtime package imports a couple of general internal packages.
if p.Standard && (p.ImportPath == "internal/cpu" || p.ImportPath == "internal/bytealg") {
compilingRuntime = true
}
if compilingRuntime {
// runtime compiles with a special gc flag to check for
// memory allocations that are invalid in the runtime package,
// and to implement some special compiler pragmas.
gcargs = append(gcargs, "-+")
}

We should update the list, and add a test to make sure they don't fall out of sync again in the future.

Alternatively, cmd/go can just use its knowledge of which packages runtime depends on.

/cc @bcmills @mknyszek

Activity

added
NeedsFixThe path to resolution is known, but the work has not been done.
on Mar 20, 2021
added this to the Go1.17 milestone on Mar 20, 2021
gopherbot

gopherbot commented on Mar 31, 2021

@gopherbot
Contributor

Change https://golang.org/cl/306289 mentions this issue: go/src/cmd/go/internal/work: compile "internal/abi" with "-+"

locked and limited conversation to collaborators on Apr 2, 2022
added a commit that references this issue on Apr 29, 2024
2d88f8f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mdempsky@bcmills@gopherbot

        Issue actions

          cmd/go: "internal/abi" needs to be compiled with "-+" · Issue #45144 · golang/go