Open k-takata opened 6 years ago
/cc @ianlancetaylor
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.
Labelled as "help wanted".
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: https://github.com/golang/go/blob/5c432fe0e3755255d70d1ad601725b039becb7ad/src/cmd/cgo/gcc.go#L1586
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