public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* _FORTIFY_SOURCE and libtool
       [not found]   ` <83adcf9d-c833-8a1f-2830-d370266c1a06@t-online.de>
@ 2019-09-17  4:31     ` Liu Hao
  0 siblings, 0 replies; only message in thread
From: Liu Hao @ 2019-09-17  4:31 UTC (permalink / raw)
  To: mingw-w64-public, gcc-help; +Cc: Christian Franke


[-- Attachment #1.1: Type: text/plain, Size: 2555 bytes --]

As GCC sets `-D_FORTIFY_SOURCE=2` (maybe it's MSYS2 or `makepkg` well I
don't really care about which one it is), those `__*_chk()` functions
are now required when building GCC and its libraries. Unfortunately,
mingw-w64 does not provide these (it relies libssp to provide them), so
the build now fails with undefined references.

I tried adding `-fstack-protector` into `LDFLAGS` and adding `-lssp`
into `LIBS` when configuring GCC, but neither worked for me. The build
process errorred out when building either libiberty or libcpp.

Tampering with GCC builtin specs may be a solution, but I am not sure
whether libtool likes that. It ignores default libraries and always
attempts to link against everything at its own disposal.

I am not sure whether libssp is (rather, can be made) available when
building libiberty. Or this _FORTIFY_SOURCE thing should be disabled
when building GCC for mingw-w64.

Any suggestions will be appreciated.


Build logs:

```
libtool: link:
/e/GitHub/MINGW-packages/mingw-w64-gcc-git/src/build-x86_64-w64-mingw32/./prev-gcc/xgcc
-B/e/GitHub/MINGW-packages/mingw-w64-gcc-git/src/build-x86_64-w64-mingw32/./prev-gcc/
-B/mingw64/x86_64-w64-mingw32/bin/ -L/mingw64/x86_64-w64-mingw32/lib
-L/mingw64/lib -isystem /mingw64/x86_64-w64-mingw32/include -isystem
/mingw64/include -B/mingw64/x86_64-w64-mingw32/bin/
-B/mingw64/x86_64-w64-mingw32/lib/ -isystem
/mingw64/x86_64-w64-mingw32/include -isystem
/mingw64/x86_64-w64-mingw32/sys-include   -fno-checking -shared
.libs/lto-plugin.o   -L/mingw64/x86_64-w64-mingw32/lib -L/mingw64/lib
-static-libgcc ../libiberty/libiberty.a -static-libstdc++ -static-libgcc
-Wl,--stack -Wl,12582912   -o .libs/liblto_plugin-0.dll
-Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker
.libs/liblto_plugin.dll.a
C:\MinGW\MSYS2\mingw64\x86_64-w64-mingw32\bin\ld.exe:
../libiberty/libiberty.a(simple-object-coff.o):simple-object-coff.c:(.text+0xb3a):
undefined reference to `__memcpy_chk'
C:\MinGW\MSYS2\mingw64\x86_64-w64-mingw32\bin\ld.exe:
../libiberty/libiberty.a(simple-object-mach-o.o):simple-object-mach-o.c:(.text+0xc91):
undefined reference to `__strncpy_chk'
C:\MinGW\MSYS2\mingw64\x86_64-w64-mingw32\bin\ld.exe:
../libiberty/libiberty.a(simple-object-xcoff.o):simple-object-xcoff.c:(.text+0x7b5):
undefined reference to `__memcpy_chk'
C:\MinGW\MSYS2\mingw64\x86_64-w64-mingw32\bin\ld.exe:
../libiberty/libiberty.a(xstrerror.o):xstrerror.c:(.text+0x4a):
undefined reference to `__chk_fail'

```


-- 
Best regards,
LH_Mouse


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-17  4:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <e3ef3df4-007a-468a-7594-9ce1a0f7eeb7@t-online.de>
     [not found] ` <alpine.DEB.2.20.1909132304310.6969@cone.martin.st>
     [not found]   ` <83adcf9d-c833-8a1f-2830-d370266c1a06@t-online.de>
2019-09-17  4:31     ` _FORTIFY_SOURCE and libtool Liu Hao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).