termux-packages/packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch

53 lines
1.8 KiB
Diff
Raw Normal View History

2019-03-14 04:46:10 +01:00
--- ./tools/clang/lib/Driver/ToolChains/Linux.cpp.orig 2018-07-30 19:44:13.000000000 +0000
+++ ./tools/clang/lib/Driver/ToolChains/Linux.cpp 2019-03-14 03:42:40.783434246 +0000
@@ -291,7 +291,10 @@
// possible permutations of these directories, and seeing which ones it added
// to the link paths.
path_list &Paths = getFilePaths();
2019-03-14 04:46:10 +01:00
-
+ if(IsAndroid) {
2019-02-25 23:20:01 +01:00
+ addPathIfExists(D, SysRoot + "@TERMUX_PREFIX@/lib", Paths);
2019-03-14 04:46:10 +01:00
+ ExtraOpts.push_back("-rpath=@TERMUX_PREFIX@/lib");
+ }
const std::string OSLibDir = getOSLibDir(Triple, Args);
const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot);
2019-03-14 04:46:10 +01:00
@@ -628,8 +631,27 @@
2019-02-17 01:34:52 +01:00
return;
if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
+ if (getTriple().isAndroid()) {
+ switch (getTriple().getArch()) {
+ case llvm::Triple::x86_64:
+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/x86_64-linux-android");
+ break;
+ case llvm::Triple::x86:
+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/i686-linux-android");
+ break;
+ case llvm::Triple::aarch64:
+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/aarch64-linux-android");
+ break;
+ case llvm::Triple::arm:
+ case llvm::Triple::thumb:
+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/arm-linux-androideabi");
+ break;
+ default:
+ break;
+ }
+
addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include");
-
+ }
if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
SmallString<128> P(D.ResourceDir);
llvm::sys::path::append(P, "include");
2019-03-14 04:46:10 +01:00
@@ -903,7 +925,7 @@
}
bool Linux::isPIEDefault() const {
- return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
2019-02-17 01:34:52 +01:00
+ return getTriple().isAndroid() ||
getTriple().isMusl() || getSanitizerArgs().requiresPIE();
}