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: "x86_64-w64-mingw32/bin/ld.exe: Error: export ordinal too large" after upgrading to Go 1.15 #40795

Open
bep opened this issue Aug 14, 2020 · 8 comments

Comments

@bep
Copy link
Contributor

@bep bep commented Aug 14, 2020

I have a Travis build that fails on Windows after upgrading to Go 1.15, see:

See: https://travis-ci.org/github/gohugoio/hugo/builds/717877247

Or more specific: https://travis-ci.org/github/gohugoio/hugo/jobs/717877253

x86_64-w64-mingw32/bin/ld.exe: Error: export ordinal too large: 77173
@deadprogram
Copy link

@deadprogram deadprogram commented Aug 15, 2020

This looks like a case of needing the flag -buildmode=exe when building Go programs for Windows that use CGo. Seems linking Windows ASLR executables is what is not working.

@networkimprov
Copy link

@networkimprov networkimprov commented Aug 15, 2020

@gopherbot add OS-Windows

cc @alexbrainman

@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Aug 15, 2020

I do not know what the problem is.

But go 1.15 now passes --dynamicbase and --high-entropy-va flags to gcc for ASLR support. Perhaps your failure is related. Maybe you need to update your Mingw.

You can disable new flags by passing -buildmode=exe to go command as @deadprogram suggested.

Alex

@networkimprov
Copy link

@networkimprov networkimprov commented Aug 16, 2020

A search for that error suggests that too many symbols are exported by a DLL. Is export the default when it doesn't need to be?

cc @zx2c4 @ianlancetaylor

@networkimprov
Copy link

@networkimprov networkimprov commented Aug 16, 2020

@bep, everything builds except commands.test -- what's different about it?

@dmitshur dmitshur added this to the Backlog milestone Aug 17, 2020
@dmitshur dmitshur changed the title x86_64-w64-mingw32/bin/ld.exe: Error: export ordinal too large cmd/link: x86_64-w64-mingw32/bin/ld.exe: Error: export ordinal too large Aug 17, 2020
@dmitshur
Copy link
Member

@dmitshur dmitshur commented Aug 17, 2020

Also /cc @cherrymui @aclements per owners.

@dmitshur dmitshur changed the title cmd/link: x86_64-w64-mingw32/bin/ld.exe: Error: export ordinal too large cmd/link: "x86_64-w64-mingw32/bin/ld.exe: Error: export ordinal too large" after upgrading to Go 1.15 Aug 17, 2020
@bep
Copy link
Contributor Author

@bep bep commented Aug 18, 2020

@bep, everything builds except commands.test -- what's different about it?

Compared to the other test packages, it starts a HTTP server ... But the main package also does that.

Note that I got the build going with buildMode=exe.

chenbh added a commit to concourse/ci that referenced this issue Aug 24, 2020
Something about DLLs and too many symbols
golang/go#40795

Signed-off-by: Bohan Chen <bochen@pivotal.io>
gythialy added a commit to qlcchain/go-qlc that referenced this issue Sep 14, 2020
golang/go#40795

Signed-off-by: Goren G <yong.gu@qlink.mobi>
@hackf5
Copy link

@hackf5 hackf5 commented Sep 19, 2020

Just got the latest version and tried to build on windows with go version go1.15.2 windows/amd64

C:\dev\go\pkg\tool\windows_amd64\link.exe: running g++ failed: exit status 1
C:/dev/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: error: export ordinal too large: 77248
collect2.exe: error: ld returned 1 exit status

Adding -buildmode=exe fixes the issue, but it still doesn't work straight out of the box.

Hmm, seems like the problems are more serious than this because after building the exe doesn't do anything. Don't worry about it, I'll get the binaries.

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
7 participants
You can’t perform that action at this time.