When building a package which specifies -fstack-protector-all in CFLAGS/LDFLAGs the resulting mingw32 binary needs libssp-0.dll. No amount of -static / -Wl,-static -lssp makes it statically link it. The extra dependency is a bit of a nuance especially when building DLLs, and native -fstack-protector-all binaries don't have this behavior. To reproduce, take a package that turns on stack protector as part of its autoconf setup (http://opus-codec.org/ for example) and mingw32-configure it.
I just tried to reproduce this here, but it seems to work as expected with mingw32-gcc-4.7.0-2.fc17.x86_64: $ cat test.c #include <stdio.h> int main(int argc, char **argv) { printf("Hello world\n"); return 0; } $ i686-w64-mingw32-gcc test.c -o test.exe -fstack-protector-all $ i686-w64-mingw32-objdump -p test.exe | grep "DLL Name" DLL Name: KERNEL32.dll DLL Name: msvcrt.dll DLL Name: libssp-0.dll $ i686-w64-mingw32-gcc -static test.c -o test.exe -fstack-protector-all $ i686-w64-mingw32-objdump -p test.exe | grep "DLL Name" DLL Name: KERNEL32.dll DLL Name: msvcrt.dll DLL Name: msvcrt.dll
Hm. I'll see what distinguishes our test cases and report back… since being able to manually make it static would be a big improvement. But I don't believe that libssp-0 being static with -static is the expected behavior in any case. That would be like dynamically linking libgcc. On the native Linux binaries you never see libssp dynamically linked.
hmm, by using '-static' option on gcc's frontend, it is absolutely to be expected that only the static-libraries are linked. This is true as long as there is a .dll.a and a .a library of same name present.
To clarify: I mean I expect ssp to be static no matter if -static is set or not.
This expectation is not correct. By default gcc uses shared (means on Windoze DLL) libraries. As libssp is built as DLL version and as static version, of course it uses by default the shared one. If you want to force static version of a library, then you need to add it explicit to the linker. Also be aware that in combination with libtool things might get weird about static/shared, too.
If you say so— though this simply isn't the behavior it has on native binaries: [gmaxwell@helmholtz tmp]$ gcc test.c -o test -fstack-protector-all [gmaxwell@helmholtz tmp]$ ldd test linux-vdso.so.1 => (0x00007fffc618e000) libc.so.6 => /lib64/libc.so.6 (0x00000038ef600000) /lib64/ld-linux-x86-64.so.2 (0x00000038ef200000) Though yes indeed, it confuses the heck out of libtool which actually was my problem in getting it to produce a static binary— intermediate libraries were introducing the dynamic dependency when -static was only set at the final linking stage.
This message is a reminder that Fedora 17 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 17. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '17'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 17's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 17 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior to Fedora 17's end of life. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. Thank you for reporting this bug and we are sorry it could not be fixed.