>
> I'm not so sure; a normal C struct or array would never have a global
> symbol defined in the middle or at the end, so a smart compiler might
> some day assume that if you take a symbol and decrement it, it's an
> invalid pointer.  I don't really want to argue much more than that,
> and I don't have a specific thing to point to in the C standard.

I can't comment on the specifics of the spec but I would say that if this
did happen in future then many toolchains in the wild would break with that
optimisation, either resulting in a revert of that new pass or addition of
an exception for __*_END__ or all those toolchains will have to be changed.
It is highly unlikely we will ever face this problem and we won't face it
alone regardless.



On Fri, Aug 18, 2017 at 8:46 PM, Martell Malone <[email protected]>
wrote:

> Attached updated patch.
>
> I was itching to invert the .ctors markers so that I could do while (*p)
> instead of while (*p != (func_ptr) -1)
> but that would create another binutils breakage so I left it.
>
> Let me know how you all want to proceed :)
>
> On Fri, Aug 18, 2017 at 8:39 PM, David Grayson <[email protected]>
> wrote:
>
>> On Fri, Aug 18, 2017 at 12:26 PM, Martin Storsjö <[email protected]>
>> wrote:
>> > Yup, that resolves the concern.
>> >
>> > As long as you just use one or the other of *_LIST__ or *_END__ in each
>> > function and use the sentinel values instead of comparing the pointers,
>> it
>> > should be fine. Otherwise the compiler is free to regard the comparison
>> as
>> > nonsense.
>> >
>> > // Martin
>>
>> I'm not so sure; a normal C struct or array would never have a global
>> symbol defined in the middle or at the end, so a smart compiler might
>> some day assume that if you take a symbol and decrement it, it's an
>> invalid pointer.  I don't really want to argue much more than that,
>> and I don't have a specific thing to point to in the C standard.
>>
>> --David
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Mingw-w64-public mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to