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
fatalf("cannot parse gcc output %s as ELF, Mach-O, PE object", gccTmp())
I suppose debug/pe doesn't support the big-obj format.
Background
I'm now trying to use wxGo, but the size of an executable file is quite big (~30MB), so I tried to reduce the size by using -fdata-sections -ffunction-sections CPPFLAGS and -Wl,--gc-sections LDFLAGS. (See: https://stackoverflow.com/a/6770305/4570471)
However, this caused the following error:
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/as.exe: $WORK\b001\_x003.o: too many sections (70137)
C:\Users\*******\AppData\Local\Temp\ccjbnMxS.s: Fatal error: can't close $WORK\b001\_x003.o: File too big
This is because the traditional PE-COFF format stores the number of sections with a 16-bit signed integer. To support more than 32K sections, the big-obj format is needed, and the -Wa,-mbig-obj CPPFLAGS can be used for that. However, cgo doesn't support the big-obj format.
Steps to reproduce:
path C:\TDM-GCC-64\bin;%PATH%
set "CGO_LDFLAGS_ALLOW=-Wl,--subsystem,windows|-mwindows"
set "CGO_CPPFLAGS_ALLOW=-fdata-sections|-ffunction-sections|-Wa,-mbig-obj"
go get -u -d github.com/dontpanic92/wxGo/wx
cd %GOPATH%\src\github.com\dontpanic92\wxGo
gopherbot
removed
the
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
label
Mar 12, 2018
I think this will all start working if we modify the debug/pe package to support the big-obj format. I haven't looked at the format, but assuming there is nothing weird about it we should just go ahead and do that.
cgo doesn't support the big-obj format.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?What did you do?
I tried to link a
.o
file which is generated with the-Wa,-mbig-obj
gcc option.See the following background for detail.
What did you expect to see?
The big-obj format is supported by cgo.
What did you see instead?
The message is produced at here:
go/src/cmd/cgo/gcc.go
Line 1586 in 5c432fe
I suppose
debug/pe
doesn't support the big-obj format.Background
I'm now trying to use wxGo, but the size of an executable file is quite big (~30MB), so I tried to reduce the size by using
-fdata-sections -ffunction-sections
CPPFLAGS and-Wl,--gc-sections
LDFLAGS. (See: https://stackoverflow.com/a/6770305/4570471)However, this caused the following error:
This is because the traditional PE-COFF format stores the number of sections with a 16-bit signed integer. To support more than 32K sections, the big-obj format is needed, and the
-Wa,-mbig-obj
CPPFLAGS can be used for that. However, cgo doesn't support the big-obj format.Steps to reproduce:
Then apply the following patch to wxGo:
Then:
The following error is shown:
Cf. in case of Haskell: https://ghc.haskell.org/trac/ghc/ticket/13815
The text was updated successfully, but these errors were encountered: