FS#42313 - [mingw-w64-gcc] is compiled without --disable-libssp

Attached to Project: Community Packages
Opened by Ahmed W. (OneOfOne) - Thursday, 09 October 2014, 15:33 GMT
Last edited by Sergej Pupykin (sergej) - Wednesday, 29 April 2015, 21:19 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sergej Pupykin (sergej)
Architecture All
Severity Low
Priority Normal
Reported Version 4.1.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Summary and Info:
community/mingw-w64-gcc is compiled without --disable-libssp, which for some odd reason forces you to link against `-lssp`.

This breaks cross-compiling Go code using cgo.

Steps to Reproduce:

hg clone -u release https://code.google.com/p/go
cd go
env GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC_FOR_TARGET="x86_64-w64-mingw32-gcc" ./make.bash

Errors out with:

# runtime/cgo
/usr/lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.text+0x4f7): undefined reference to `__stack_chk_fail'
/usr/lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.rdata$.refptr.__stack_chk_guard[.refptr.__stack_chk_guard]+0x0): undefined reference to `__stack_chk_guard'
/usr/lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/bin/ld: /usr/lib/gcc/x86_64-w64-mingw32/4.9.1/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o: bad reloc address 0x0 in section `.rdata$.refptr.__stack_chk_guard[.refptr.__stack_chk_guard]'
collect2: error: ld returned 1 exit status

Adding -fno-stack-protector and -D_FORTIFY_SOURCE=0 doesn't do anything, the only way to successfully compile it is to link against ssp

env GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC_FOR_TARGET="x86_64-w64-mingw32-gcc -fno-stack-protector -D_FORTIFY_SOURCE=0 -lssp" ./make.bash
This task depends upon

Closed by  Sergej Pupykin (sergej)
Wednesday, 29 April 2015, 21:19 GMT
Reason for closing:  Won't fix
Additional comments about closing:  looks like Go problem
see also  FS#44767 
Comment by Ahmed W. (OneOfOne) - Tuesday, 02 December 2014, 01:54 GMT
I hate to be that guy, but bump.