Hello.
Commit ca451a7a45d4876065edc6755f8aab8095914b04 caused issue #1104 in
MSYS2, where basic C++ programs stopped working, probably because
constructors were not called:
https://github.com/Alexpux/MINGW-packages/issues/1104
If you compile a simple C++ hello world program, you can run the
following command on it to see where the relevant symbols are getting
placed:
objdump -t prog.exe | egrep 'TOR_LIST|dtors|ctors'
On my machine, using a 64-bit toolchain, I'm seeing that __CTOR_LIST__
is at 0x1e60 while __MINGW_CTOR_LIST__ is at 0x1e70. That is a
difference of 16 bytes, so there are two constructors that wouldn't
get run if you choose to use __MINGW_CTOR_LIST__ as the starting point
for your loop that calls all the constructors. There is also a
discrepancy for the destructors.
The symbols __CTOR_LIST__ and __DTOR_LIST__ are actually defined in
the linker script. My evidence for that is that if I compile a C++
program with "-Wl,-verbose", the default linker script is printed, and
it has these lines to define __CTOR_LIST__ and __DTOR_LIST__ properly:
. = ALIGN(8);
___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
LONG (-1); LONG (-1);*(.ctors); *(.ctor);
*(SORT(.ctors.*)); LONG (0); LONG (0);
___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
LONG (-1); LONG (-1); *(.dtors); *(.dtor);
*(SORT(.dtors.*)); LONG (0); LONG (0);
*(.fini)
The statement "___CTOR_LIST__ = ." tells the linker to define a symbol
named ___CTOR_LIST__ at the current location (.). Then it puts some
padding data, and then it puts all the constructors, and then it puts
a null terminator.
In contrast, the newly-introduced symbols __MINGW_CTOR_LIST__ and
__MINGW_DTOR_LIST__ do not work properly because they were not placed
in the right locations using a linker script. They were just defined
as static variables in a particular section.
Martell, I gather that you were working on some clang-based toolchain
and you had trouble because __CTOR_LIST__ and __DTOR_LIST__ were not
defined. Could you solve your issue by defining them in your linker
script or something? I think commit
ca451a7a45d4876065edc6755f8aab8095914b04 can be reverted.
--David
On Sun, Feb 28, 2016 at 1:14 AM, Alexpux <[email protected]> wrote:
>
>> 28 февр. 2016 г., в 12:12, JonY <[email protected]> написал(а):
>>
>> On 2/24/2016 01:14, Martell Malone wrote:
>>> I pushed all the patches that were previously approved by either yourself
>>> or kai.
>>> While kai already approved this I would like someone other then myself to
>>> confirm this patch doesn't break anything.
>>> Handle __CTOR_LIST__ internally within mingw-w64
>>> This specifically is needed so that we can use compiler-rt instead of
>>> libgcc with clang.
>>> Other then that every patch should be in tree for armv7 support.
>>>
>>
>> Hi Martell, looks like the __CTOR_LIST__ broke gcc6, can you check it
>> out? Thanks.
>>
>
> I can config that it breaks any GCC.
>
> Regards,
> Alexey.
>
>> <0xD4EBC740.asc>------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140_______________________________________________
>> Mingw-w64-public mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> Mingw-w64-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public