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