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/link: error on windows/arm64 with clang/lld 13.0.1 #51903

Closed
jeremyd2019 opened this issue Mar 23, 2022 · 8 comments
Closed

cmd/link: error on windows/arm64 with clang/lld 13.0.1 #51903

jeremyd2019 opened this issue Mar 23, 2022 · 8 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@jeremyd2019
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.18 windows/arm64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=
set GOARCH=arm64
set GOBIN=
set GOCACHE=C:\Users\Administrator\AppData\Local\go-build
set GOENV=C:\Users\Administrator\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=arm64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Administrator\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Administrator\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\msys64\clangarm64\lib\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\msys64\clangarm64\lib\go\pkg\tool\windows_arm64
set GOVCS=
set GOVERSION=go1.18
set GCCGO=gccgo
set AR=ar
set CC=clang
set CXX=clang++
set CGO_ENABLED=1
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\msys64\tmp\go-build1929041516=/tmp/go-build -gno-record-gcc-switches

Windows 11 ARM64, running MSYS2's package of clang/llvm/lld 13.0.1.

What did you do?

Download and extract https://downloads.rclone.org/v1.58.0/rclone-v1.58.0.tar.gz

  go build -ldflags -s
  (
    cd librclone
    go build --buildmode=c-shared -ldflags -s -o librclone.dll
  )

What did you expect to see?

Successful build.

What did you see instead?

# github.com/rclone/rclone/librclone
.debug_frame+1MB: addpesym: could not map .debug_frame+1MB symbol with non .text or .rdata or .data section
.debug_frame+2MB: addpesym: could not map .debug_frame+2MB symbol with non .text or .rdata or .data section

I have also seen this same error with hugo, but in that case the error only occurred when -ldflags=-linkmode=external was used and went away without that option.

@jeremyd2019 jeremyd2019 changed the title link error on windows/arm64 with clang/lld link error on windows/arm64 with clang/lld 13.0.1 Mar 23, 2022
@jeremyd2019
Copy link
Author

That error message appears to come from

return 0, 0, fmt.Errorf("could not map %s symbol with non .text or .rdata or .data section", ldr.SymName(s))

@gopherbot
Copy link

Change https://go.dev/cl/395215 mentions this issue: cmd/link: do not add label symbols for DWARF on Windows/ARM64

@cherrymui
Copy link
Member

I don't have a way to test it. Could you try if CL https://go-review.googlesource.com/c/go/+/395215 fixes it? Thanks!

@mknyszek mknyszek changed the title link error on windows/arm64 with clang/lld 13.0.1 cmd/link: error on windows/arm64 with clang/lld 13.0.1 Mar 23, 2022
@mknyszek mknyszek added OS-Windows NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Mar 23, 2022
@mknyszek mknyszek added this to the Backlog milestone Mar 23, 2022
@jeremyd2019
Copy link
Author

jeremyd2019 commented Mar 24, 2022

I applied that patch to go 1.18, rebuilt go, and then built librclone. It successfully built the DLL, but trying to load it gives an error that it's not a valid Win32 application. I don't know if that's the same bug as this or not though.

@jeremyd2019
Copy link
Author

That patch did however result in a successful and functional hugo.exe built with -ldflags=-linkmode=external

@jeremyd2019
Copy link
Author

I haven't been able to figure out what's wrong with the DLL that Windows won't load it. I'm attaching it in case somebody has some idea of what to look for.

librclone.zip

@cherrymui
Copy link
Member

Thanks for testing. It seems the CL does fix the immediate issue.

trying to load it gives an error that it's not a valid Win32 application.

This looks like something different. How do you load the DLL?

@jeremyd2019
Copy link
Author

I created a new issue to discuss the invalid DLL

@golang golang locked and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants