Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: TestWindowsDefaultBuildmodIsPIE/cgo fails on windows-arm64-aws #46510

Open
dmitshur opened this issue Jun 2, 2021 · 6 comments
Open

cmd/go: TestWindowsDefaultBuildmodIsPIE/cgo fails on windows-arm64-aws #46510

dmitshur opened this issue Jun 2, 2021 · 6 comments

Comments

@dmitshur
Copy link
Contributor

@dmitshur dmitshur commented Jun 2, 2021

--- FAIL: TestWindowsDefaultBuildmodIsPIE (0.00s)
    --- FAIL: TestWindowsDefaultBuildmodIsPIE/cgo (9.23s)
        go_test.go:2129: running testgo [build -o C:\Users\gopher\AppData\Local\Temp\cmd-go-test-577963624\gotest1567665900\main.exe C:\Users\gopher\AppData\Local\Temp\cmd-go-test-577963624\gotest1567665900\main.go]
        go_test.go:2188: .edata section is not present
go test proxy running at GOPROXY=http://127.0.0.1:52061/mod
FAIL
FAIL	cmd/go	362.581s

Source: https://storage.googleapis.com/go-build-log/152255c1/windows-arm64-aws_1dc534d5.log from CL 323992.

This needs investigation.

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 2, 2021

Change https://golang.org/cl/323993 mentions this issue: cmd/go: skip TestWindowsDefaultBuildmodIsPIE/cgo on windows/arm64

@bcmills
Copy link
Member

@bcmills bcmills commented Jun 2, 2021

@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Jun 3, 2021

The code that fails

go/src/cmd/go/go_test.go

Lines 2181 to 2189 in 18e666b

// Test that only one symbol is exported (#40795).
// PIE binaries don´t require .edata section but unfortunately
// binutils doesn´t generate a .reloc section unless there is
// at least one symbol exported.
// See https://sourceware.org/bugzilla/show_bug.cgi?id=19011
section := f.Section(".edata")
if section == nil {
t.Fatalf(".edata section is not present")
}

was added in

https://go-review.googlesource.com/c/go/+/264459

The code assumes that exported symbols are stored in .edata PE section. And that is a reasonable assumption for executable built with Mingw GCC.

Perhaps that assumption is incorrect for whatever C compiler is used on windows-amd64 builder. I would try to build executable as per test and look at executable PE sections.

/cc @qmuntal and @zx2c4 in case they have suggestions here

Alex

@qmuntal
Copy link
Contributor

@qmuntal qmuntal commented Jun 3, 2021

Assumption: windows-arm64-aws uses a llvm toolchain.

I don't really know much about llvm/clang, but looking at the lld source code it seems that the exported symbols are also stored in .edata.

My guess is that:

  • The cgo toolchain is missing some parameters when invoking clang
  • Or lld (clang's linker) is not seeing any exported symbol, thus it is not creating the .edata section.
@dmitshur
Copy link
Contributor Author

@dmitshur dmitshur commented Jun 4, 2021

See here for more information about the C toolchain windows-arm64-aws uses.

@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Jun 4, 2021

See here for more information about the C toolchain windows-arm64-aws uses.

Thanks for the link, but I don't have and don't use windows-arm64. So I don't plan working on it.

Alex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants