Use -fuse-init-array if no gcc installation is found.
authorNico Weber <nicolasweber@gmx.de>
Thu, 26 Oct 2017 23:26:29 +0000 (23:26 +0000)
committerNico Weber <nicolasweber@gmx.de>
Thu, 26 Oct 2017 23:26:29 +0000 (23:26 +0000)
commit0763ab4d6aefc915f573fb738e7a1fd14d74e514
tree6c674f51e70b7333f3b15a9c9310a085143b006c
parenta6021e3bc12947dabedbdddb0270cb1af66a29b5
Use -fuse-init-array if no gcc installation is found.

clang currently uses .init_array instead of .ctors on Linux if it detects gcc
4.7+. Make it so that it also uses .init_array if no gcc installation is found
at all – if there's no old gcc, there's nothing we need to be compatible with.

icecc for example runs clang in a very small chroot, so before this change
clang would use .ctors if run under icecc. And lld currently silently mislinks
inputs with .ctors sections, so before this clang + icecc + lld would produce
broken binaries. (But this seems like a good change independent of that lld
bug.)

https://reviews.llvm.org/D39317

llvm-svn: 316713
clang/docs/ReleaseNotes.rst
clang/lib/Driver/ToolChains/Gnu.cpp
clang/test/Driver/constructors.c