This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Regression in 2.30 for MinGW constructors/destructors
- From: Martin Storsjö <martin at martin dot st>
- To: binutils at sourceware dot org
- Date: Mon, 9 Jul 2018 00:06:05 +0300 (EEST)
- Subject: Regression in 2.30 for MinGW constructors/destructors
Hi,
It seems like the following commit introduced a regression for
constructors for MinGW:
commit ca6f2be7f6bc638fd4fad48def1fae4ae4d7906e
Author: Nick Clifton <nickc@redhat.com>
Date: Thu Aug 10 13:17:12 2017 +0100
Add support for PE startup files that want to define their own constructor and desctructor sequencing.
* scripttempl/pep.sc: Enclose __CTOR_LIST__, ___CTOR_LIST__,
__DTOR_LIST__ and ___DTOR_LIST__ in PROVIDE statements so that
they can be overrridden by crt input files.
* scripttempl/pe.sc: Likewise.
After this commit, setups with existing versions of mingw-w64 no longer
run constructors.
The reason seems to be that if mingw-w64 startup files don't provide
definitions of __CTOR_LIST__ etc (which they don't normally), the linker
will fall back to a dummy __CTOR_LIST__ from libgcc.a(_ctors.o), and this
__CTOR_LIST__ doesn't get sorted into the right location like either the
linker script version does, or a manually defined one that provides
explicit section placement.
// Martin