[PATCH] ld: Improve the comment about overriding __CTOR_LIST__ for mingw targets
Martin Storsjö
martin@martin.st
Mon Aug 6 10:51:00 GMT 2018
Hi Nick,
You handled this matter earlier (the original commit from last year and
the later revert with a warning comment in the linker script) - can you
comment on this patch that tries to clarify the comment?
// Martin
On Fri, 3 Aug 2018, Martin Storsjo wrote:
> Explain what happens in the cases if the user actually tries to
> provide such symbols from source as well - it's actually a less
> dramatic or problematic situation than originally outlined.
>
> ld/Changelog:
> 2018-08-03 Martin Storsjo <martin@martin.st>
>
> * scripttempl/pe.sc: Improve the comment about overriding
> __CTOR_LIST__ and __DTOR_LIST__ symbols.
> * scripttemp/pep.sc: Likewise.
> ---
> mingw-w64 will probably move to unconditionally provide these symbols
> themselves, in order to improve compatibility with other linkers (lld).
> The fact that the linker also provides them only causes double list
> terminator elements; if the code iterating the list is prepared to
> handle that case, it actually turns out to work fine.
> ---
> ld/scripttempl/pe.sc | 10 ++++++----
> ld/scripttempl/pep.sc | 10 ++++++----
> 2 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc
> index f56d783ea03..3a2a331f681 100644
> --- a/ld/scripttempl/pe.sc
> +++ b/ld/scripttempl/pe.sc
> @@ -106,10 +106,12 @@ SECTIONS
> overridden and global constructors will not be run.
>
> This does mean that it is not possible for a user to define
> - their own __CTOR_LIST__ and __DTOR_LIST__ symbols. If that
> - ability is needed a custom linker script will have to be
> - used. (The custom script can just be a copy of this script
> - with the PROVIDE() qualifiers added).
> + their own __CTOR_LIST__ and __DTOR_LIST__ symbols; if they do,
> + the content from those variables are included but the symbols
> + defined here silently take precedence. If they truly need to
> + redefined, a custom linker script will have to be used. (The
> + custom script can just be a copy of this script with the
> + PROVIDE() qualifiers added).
>
> See PR 22762 for more details. */
> ___CTOR_LIST__ = .;
> diff --git a/ld/scripttempl/pep.sc b/ld/scripttempl/pep.sc
> index 3c6c84da9bf..fb88c144430 100644
> --- a/ld/scripttempl/pep.sc
> +++ b/ld/scripttempl/pep.sc
> @@ -107,10 +107,12 @@ SECTIONS
> overridden and global constructors will not be run.
>
> This does mean that it is not possible for a user to define
> - their own __CTOR_LIST__ and __DTOR_LIST__ symbols. If that
> - ability is needed a custom linker script will have to be
> - used. (The custom script can just be a copy of this script
> - with the PROVIDE() qualifiers added).
> + their own __CTOR_LIST__ and __DTOR_LIST__ symbols; if they do,
> + the content from those variables are included but the symbols
> + defined here silently take precedence. If they truly need to
> + redefined, a custom linker script will have to be used. (The
> + custom script can just be a copy of this script with the
> + PROVIDE() qualifiers added).
>
> See PR 22762 for more details. */
> ___CTOR_LIST__ = .;
> --
> 2.15.2 (Apple Git-101.1)
>
>
More information about the Binutils
mailing list