mailing list of musl libc
 help / color / mirror / code / Atom feed
96446332ec7d7c056ebc31a5a34718a7149d5bb7 blob 1183 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
From f0ecb3850d7825cd967d22c09ed73d990605c70b Mon Sep 17 00:00:00 2001
From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
Date: Mon, 11 Jan 2021 10:39:27 +1100
Subject: [PATCH 3/3] clang: support expanding target triple in sysroot path

This allows clang to switch sysroot (or, more usefully, default sysroot)
based on target triple.

For example, configuring with

-DDEFAULT_SYSROOT=../TARGET

will automatically select a target specific sysroot one level up from
the clang binary location.
---
 clang/lib/Driver/Driver.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index ece8222dcf24..8a3b068d86b9 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1121,6 +1121,13 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
                     .Default(SaveTempsCwd);
   }
 
+  // expand TARGET in sysroot path
+  if (!SysRoot.empty()) {
+    size_t pos{0};
+    while ((pos = SysRoot.find("TARGET", pos)) != std::string::npos)
+      SysRoot.replace(pos, 6, TargetTriple);
+  }
+
   setLTOMode(Args);
 
   // Process -fembed-bitcode= flags.
-- 
2.30.0

debug log:

solving 9644633 ...
found 9644633 in https://inbox.vuxu.org/musl/CAEg67GktBDq+_vGF4hNC47OW8TZVpQdkDR=BnqCxDYTYwBsGKg@mail.gmail.com/ ||
	https://inbox.vuxu.org/musl/CAEg67G=3RVgfYKVjaAiCfGxGeB+TxQ3A6u=XFmuWYhsKvpRAPQ@mail.gmail.com/

applying [1/2] https://inbox.vuxu.org/musl/CAEg67GktBDq+_vGF4hNC47OW8TZVpQdkDR=BnqCxDYTYwBsGKg@mail.gmail.com/
diff --git a/patches/llvm-project-11.0.0/0003-clang-support-expanding-target-triple-in-sysroot-pat.patch b/patches/llvm-project-11.0.0/0003-clang-support-expanding-target-triple-in-sysroot-pat.patch
new file mode 100644
index 0000000..9644633

1:32: trailing whitespace.
 
1:41: trailing whitespace.
 
1:43: trailing whitespace.
-- 
Checking patch patches/llvm-project-11.0.0/0003-clang-support-expanding-target-triple-in-sysroot-pat.patch...
1:45: new blank line at EOF.
+
Applied patch patches/llvm-project-11.0.0/0003-clang-support-expanding-target-triple-in-sysroot-pat.patch cleanly.
warning: 4 lines add whitespace errors.

skipping https://inbox.vuxu.org/musl/CAEg67G=3RVgfYKVjaAiCfGxGeB+TxQ3A6u=XFmuWYhsKvpRAPQ@mail.gmail.com/ for 9644633
index at:
100644 96446332ec7d7c056ebc31a5a34718a7149d5bb7	patches/llvm-project-11.0.0/0003-clang-support-expanding-target-triple-in-sysroot-pat.patch

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).