On 17.01.21 14:25, Martin Storsjö wrote:
Hi,

On Sun, 17 Jan 2021, Sandro Mani wrote:

I'm working on updating the mingw toolchain for Fedora, and am building mingw-gcc-11 with mingw-crt-8.0.0. I'm stuck at this error when linking libgcc [1]:

/usr/i686-w64-mingw32/bin/ld: _ctors_s.o:libgcc2.c:(.bss+0x0): multiple definition of `__DTOR_LIST__'; /usr/i686-w64-mingw32/sys-root/mingw/lib/../lib/dllcrt2.o:crtdll.c:(.dtors+0x0): first defined here /usr/i686-w64-mingw32/bin/ld: _ctors_s.o:libgcc2.c:(.bss+0x8): multiple definition of `__CTOR_LIST__'; /usr/i686-w64-mingw32/sys-root/mingw/lib/../lib/dllcrt2.o:crtdll.c:(.ctors+0x0): first defined here

Indeed, I see

mingw-w64-crt/crt/crtdll.c:__attribute__ (( __section__ (".dtors"), __used__ , aligned(sizeof(void *)))) const void * __DTOR_LIST__ = (void *) -1; mingw-w64-crt/crt/crtdll.c:__attribute__ (( __section__ (".ctors"), __used__ , aligned(sizeof(void *)))) const void * __CTOR_LIST__ = (void *) -1;

These are within an #ifndef HAVE_CTOR_LIST. During configure (of mingw-w64-crt), there's an "checking whether the linker provides __CTOR_LIST__... yes". If you're running into such an error, it sounds to me like this test didn't produce the expected result in your case. Can you have a look in the config.log why it didn't behave as expected?

Thanks for the pointer, indeed the I get "checking whether the linker provides __CTOR_LIST__... no", reason being

configure:5889: checking whether the linker provides __CTOR_LIST__
configure:5940: i686-w64-mingw32-gcc conftest.c -fstack-protector -lssp -nostdlib -o conftest /usr/lib/gcc/i686-w64-mingw32/11.0.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lssp
collect2: error: ld returned 1 exit status

Indeed, with the bootstrapping procedure for the new CRT I've used so far (gcc-core -> crt -> gcc full (no libgomp) -> winpthreads -> gcc full (with libgomp)), libssp is not built with the first gcc bootstrapping stage (gcc-core). I guess I need to filter out -fstack-protector -lssp from the LDFLAGS when building mingw-crt.

Thanks
Sandro



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to