[llvm-dev] X86 does not follow -fuse-init-array
Fangrui Song via llvm-dev
llvm-dev at lists.llvm.org
Wed Dec 11 22:41:25 PST 2019
On 2019-12-12, kamlesh kumar wrote:
>Fangrui,
>All of the OSes/Targets which uses ELF Binary Format go for default
>-fuse-init-array except NetBSD.
>Please see here
>https://reviews.llvm.org/D71360
>
>kamlesh
I have investigated this one month ago (https://github.com/dlang/dmd/pull/10562).
The OpenBSD support is also relatively new (Aug 2016).
We can delete some -fuse-init-array tests. We only need some
-fno-use-init-array tests on platforms that may need it.
>On Thu, Dec 12, 2019 at 11:02 AM Fangrui Song <maskray at google.com> wrote:
>
> On 2019-12-10, Reid Kleckner via llvm-dev wrote:
> >I bet if you use `-target i386-linux` it will work. You passed `-target
> -i386`,
> >which is a triple with no OS, so Clang is doing something arbitrary.
> Grepping
> >Clang sources shows that this flag is handled in an OS-specific manner:
> >
> >$ git grep -i fuse_init_array ../clang/lib/Driver/
> >../clang/lib/Driver/ToolChains/Fuchsia.cpp: if (DriverArgs.hasFlag
> >(options::OPT_fuse_init_array,
> >../clang/lib/Driver/ToolChains/Gnu.cpp: if (DriverArgs.hasFlag
> >(options::OPT_fuse_init_array,
> >../clang/lib/Driver/ToolChains/NetBSD.cpp: if (DriverArgs.hasFlag
> >(options::OPT_fuse_init_array,
> >../clang/lib/Driver/ToolChains/WebAssembly.cpp: if (DriverArgs.hasFlag
> >(clang::driver::options::OPT_fuse_init_array,
> >
> >The Gnu.cpp file most likely handles the case of Linux.
> >
> >This logic looks like it is ripe for refactoring. Patches very welcome. =(
>
> We should probably make -fuse-init-array the CC1 default and the default
> for Driver/ToolChains/Gnu.cpp. Very few platforms actually use
> .ctors/.dtors nowadays. (This caused a bug this year which was fixed by
> https://reviews.llvm.org/D62509)
>
> If my suggestion does not sound too stupid, I can create a patch.
>
More information about the llvm-dev
mailing list