[Issue 20220] pragma(crt_constructor) does not work with clang 9

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 13 07:00:32 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20220

--- Comment #8 from Ernesto Castellotti <erny.castell at gmail.com> ---
(In reply to Dlang Bot from comment #7)
> @MaskRay created dlang/dmd pull request #10562 "Use .init_array/.fini_array
> instead of .ctors/.dtors" fixing this issue:
> 
> - Use .init_array/.fini_array instead of .ctors/.dtors
>   
>   Fix Issue 20220.
>   
>   dmd places global constructors in .ctors sections. When such sections
>   are linked by lld, the executable will not run constructors on most
>   modern Linux distributions (musl does not support .ctors/glibc is
>   usually configured with NO_CTORS_DTORS_SECTIONS).
>   
>   GNU ld and gold convert .ctors/.dtors to .init_array/.fini_array by
>   default, so programs linked by them are fine. lld does not support the
>   feature and it probably makes little sense to add the support
>   (https://bugs.llvm.org/show_bug.cgi?id=31224):
>   .init_array has been supported by glibc for 20 years and adopted by most
>   ELF platforms.
> 
> https://github.com/dlang/dmd/pull/10562

I would prefer to have an optional switch, maybe someone wants to have .ctors

--


More information about the Digitalmars-d-bugs mailing list