chiark / gitweb /
llvm&clang: Update from 4.0.1 to 5.0.0
[termux-packages] / packages / libllvm / tools-clang-lib-Driver-ToolChains-Gnu.cpp.patch
1 diff -u -r ../llvm-5.0.0.src/tools/clang/lib/Driver/ToolChains/Gnu.cpp ./tools/clang/lib/Driver/ToolChains/Gnu.cpp
2 --- ../llvm-5.0.0.src/tools/clang/lib/Driver/ToolChains/Gnu.cpp 2017-08-11 03:47:32.000000000 +0200
3 +++ ./tools/clang/lib/Driver/ToolChains/Gnu.cpp 2017-09-10 20:14:54.636653647 +0200
4 @@ -152,14 +152,11 @@
5      }
6    }
7  
8 -  const std::string &customGCCName = D.getCCCGenericGCCName();
9 -  const char *GCCName;
10 -  if (!customGCCName.empty())
11 -    GCCName = customGCCName.c_str();
12 -  else if (D.CCCIsCXX()) {
13 -    GCCName = "g++";
14 -  } else
15 -    GCCName = "gcc";
16 +  // Termux modification: Disable calling into gcc from clang.
17 +  // Clang calls into gcc if it tries to compile a language it doesn't understand.
18 +  // On Termux gcc is a symlink to clang, so this leads into fork loop until
19 +  // the whole system runs out of memory.
20 +  const char *GCCName = "false";
21  
22    const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath(GCCName));
23    C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
24 @@ -415,9 +412,12 @@
25    const llvm::Triple::ArchType Arch = ToolChain.getArch();
26    const bool isAndroid = ToolChain.getTriple().isAndroid();
27    const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU();
28 +  // Termux modification: Enable pie by default for Android
29 +  // and support the nopie flag.
30    const bool IsPIE =
31        !Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_static) &&
32 -      (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());
33 +      (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault() || isAndroid) &&
34 +      !Args.hasArg(options::OPT_nopie);
35    const bool HasCRTBeginEndFiles =
36        ToolChain.getTriple().hasEnvironment() ||
37        (ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies);