[llvm-dev] X86 does not follow -fuse-init-array
kamlesh kumar via llvm-dev
llvm-dev at lists.llvm.org
Wed Dec 11 21:48:25 PST 2019
All of the OSes/Targets which uses ELF Binary Format go for default
-fuse-init-array except NetBSD.
Please see here
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
> >which is a triple with no OS, so Clang is doing something arbitrary.
> >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
> >../clang/lib/Driver/ToolChains/Gnu.cpp: if (DriverArgs.hasFlag
> >../clang/lib/Driver/ToolChains/NetBSD.cpp: if (DriverArgs.hasFlag
> >../clang/lib/Driver/ToolChains/WebAssembly.cpp: if (DriverArgs.hasFlag
> >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
> If my suggestion does not sound too stupid, I can create a patch.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev