summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2017-10-26 23:26:29 +0000
committerNico Weber <nicolasweber@gmx.de>2017-10-26 23:26:29 +0000
commit0763ab4d6aefc915f573fb738e7a1fd14d74e514 (patch)
tree6c674f51e70b7333f3b15a9c9310a085143b006c /clang/lib
parenta6021e3bc12947dabedbdddb0270cb1af66a29b5 (diff)
downloadbcm5719-llvm-0763ab4d6aefc915f573fb738e7a1fd14d74e514.tar.gz
bcm5719-llvm-0763ab4d6aefc915f573fb738e7a1fd14d74e514.zip
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
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/ToolChains/Gnu.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 08d4aa51f27..08282ff0033 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2366,7 +2366,8 @@ void Generic_ELF::addClangTargetOptions(const ArgList &DriverArgs,
getTriple().getArch() == llvm::Triple::aarch64 ||
getTriple().getArch() == llvm::Triple::aarch64_be ||
(getTriple().getOS() == llvm::Triple::Linux &&
- (!V.isOlderThan(4, 7, 0) || getTriple().isAndroid())) ||
+ ((!GCCInstallation.isValid() || !V.isOlderThan(4, 7, 0)) ||
+ getTriple().isAndroid())) ||
getTriple().getOS() == llvm::Triple::NaCl ||
(getTriple().getVendor() == llvm::Triple::MipsTechnologies &&
!getTriple().hasEnvironment()) ||
OpenPOWER on IntegriCloud