You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/6l: CGO program will only link with MinGW 4.8.1 on Windows #8811
I have tried the following Go versions:
* Tip
* Official Go 1.3.1 binaries.
What steps reproduce the problem?
1. Extract attached zip file (5 files, 47 lines in total) to $GOPATH/src/
2. cd $GOPATH/src/mingwbug
3. go build
What happened?
C:\Users\stephen\Desktop\godev\src\mingwbug>go build -a main.go
# command-line-arguments
mingwbug/glfw(.text): mingwbug/glfw(/76): not defined
mingwbug/glfw(.text): undefined: mingwbug/glfw(/76)
What should have happened instead?
The program should link.
Please provide any additional information below.
The program compiles, links, and runs fine when using MinGW 4.8.1.
If using MinGW 4.8.3 OR 4.9.1 (MinGW-W64 project or TDM-GCC) then the linker reports the
errors above.
This issue is a minimal example if the problem we ran into at
go-gl/glfw#91 if you want more information.
The output is rather large? View it in full at http://pastebin.com/1niy3W2U
C:\Users\stephen\Desktop\godev\src\mingwbug>go build -x
...trimmed by me...
cd C:\Users\stephen\Desktop\godev\src\mingwbug
"C:\\tipgoamd64\\pkg\\tool\\windows_amd64\\6g.exe" -o
"C:\\Users\\stephen\\AppData\\Local\\Temp\\go-build954290891\\mingwbug.a" -t
rimpath "C:\\Users\\stephen\\AppData\\Local\\Temp\\go-build954290891" -p mingwbug
-complete -D _/C_/Users/stephen/Desktop/godev/sr
c/mingwbug -I "C:\\Users\\stephen\\AppData\\Local\\Temp\\go-build954290891" -I
"C:\\Users\\stephen\\Desktop\\godev\\pkg\\windows_a
md64" -pack "C:\\Users\\stephen\\Desktop\\godev\\src\\mingwbug\\main.go"
cd .
"C:\\tipgoamd64\\pkg\\tool\\windows_amd64\\6l.exe" -o
"C:\\Users\\stephen\\AppData\\Local\\Temp\\go-build954290891\\mingwbug\\_obj
\\exe\\a.out.exe" -L "C:\\Users\\stephen\\AppData\\Local\\Temp\\go-build954290891" -L
"C:\\Users\\stephen\\Desktop\\godev\\pkg\\wi
ndows_amd64" -extld=gcc
"C:\\Users\\stephen\\AppData\\Local\\Temp\\go-build954290891\\mingwbug.a"
# mingwbug
mingwbug/glfw(.text): mingwbug/glfw(/76): not defined
mingwbug/glfw(.text): undefined: mingwbug/glfw(/76)
Sorry, I have no idea what is going on. This is failing when running the Go linker on
Go code, so I can't see why changing the GCC version would make any difference. I also
don't know what the "(/76)" is doing there. This will have to be debugged by somebody
running Windows.
The form mingwbug/glfw(name) refers to the section name inside an object in
mingwbug/glfw. The name /76 is a PE-encoded string table reference, since they only
reserved 8 letters for the section name.
$GOROOT/src/cmd/ld/ldpe.c needs to look for the /%d form of section name and do the
appropriate translation to the correct section name.
There are 2 problems here as far as I can see (in ldpe.c):
1) section names are not read properly - that is why we see /76 in mingwbug/glfw(/76),
/76 is a reference into "string table" where real name lives;
2) ldpe.c code assumes (in a few places) that all symbols with name starting with "."
are section names - this is broken now that new gcc starts some symbols with ".".
I am not familiar with that code enough to decide how to change it safely yet. But I
will keep looking.
Alex
No, please continue with your fix. I am not certain my solution is correct. Two heads
are better then one. Whoever is ready first will discuss during review.
Alex
Activity
emidoots commentedon Sep 26, 2014
Comment 1:
Attachments:
ianlancetaylor commentedon Sep 26, 2014
Comment 2:
Labels changed: added repo-main, release-go1.4maybe, os-windows.
emidoots commentedon Sep 26, 2014
Comment 3:
ianlancetaylor commentedon Sep 26, 2014
Comment 4:
rsc commentedon Oct 7, 2014
Comment 5:
Owner changed to @rsc.
Status changed to Accepted.
rsc commentedon Oct 7, 2014
Comment 6:
Labels changed: added release-go1.4, removed release-go1.4maybe.
Owner changed to ---.
alexbrainman commentedon Oct 7, 2014
Comment 7:
alexbrainman commentedon Oct 7, 2014
Comment 8:
andlabs commentedon Oct 7, 2014
Comment 9:
gopherbot commentedon Oct 7, 2014
Comment 10 by rich.amacker:
frederich commentedon Oct 8, 2014
Comment 11:
alexbrainman commentedon Oct 8, 2014
Comment 12:
frederich commentedon Oct 8, 2014
Comment 13:
alexbrainman commentedon Oct 8, 2014
Comment 14:
frederich commentedon Oct 8, 2014
Comment 15:
11 remaining items
alexbrainman commentedon Oct 10, 2014
Comment 27:
alexbrainman commentedon Oct 11, 2014
Comment 28:
This issue was updated by revision d0ee959.
alexbrainman commentedon Oct 11, 2014
Comment 29:
This issue was closed by revision d704bb0.
Status changed to Fixed.
cmd/ld: do not assume that only pe section names start with '.'
cmd/ld: do not assume that only pe section names start with '.'
cmd/ld: do not assume that only pe section names start with '.'
cmd/ld: do not assume that only pe section names start with '.'