-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0049-Xtensa-Implement-multilib-support.patch
58 lines (51 loc) · 2.03 KB
/
0049-Xtensa-Implement-multilib-support.patch
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From 7206554902e7499dd2a763eb1892e081b92a53e8 Mon Sep 17 00:00:00 2001
From: Andrei Safronov <safronov@espressif.com>
Date: Wed, 5 Apr 2023 00:59:02 +0300
Subject: [PATCH 049/158] [Xtensa] Implement multilib support
Use Multilib class functionality to choose between library variants,
based on the command line args.
---
clang/lib/Driver/ToolChains/Xtensa.cpp | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/Xtensa.cpp b/clang/lib/Driver/ToolChains/Xtensa.cpp
index 003a10a0b9f6..a1f83801b561 100644
--- a/clang/lib/Driver/ToolChains/Xtensa.cpp
+++ b/clang/lib/Driver/ToolChains/Xtensa.cpp
@@ -29,6 +29,8 @@ using namespace clang::driver::toolchains;
using namespace clang;
using namespace llvm::opt;
+using tools::addMultilibFlag;
+
XtensaGCCToolchainDetector::XtensaGCCToolchainDetector(
const Driver &D, const llvm::Triple &HostTriple,
const llvm::opt::ArgList &Args) {
@@ -105,15 +107,28 @@ XtensaToolChain::XtensaToolChain(const Driver &D, const llvm::Triple &Triple,
IsIntegratedAsm = false;
}
+ Multilibs.push_back(Multilib());
+
+ Multilibs.push_back(
+ Multilib("no-rtti", {}, {}, 1).flag("+fno-rtti").flag("-frtti"));
+
+ Multilib::flags_list Flags;
+ addMultilibFlag(
+ Args.hasFlag(options::OPT_frtti, options::OPT_fno_rtti, false), "frtti",
+ Flags);
+
+ Multilibs.select(Flags, SelectedMultilib);
+
const std::string Slash = XtensaGCCToolchain.Slash;
std::string Libs =
XtensaGCCToolchain.GCCToolchainDir + Slash + "lib" + Slash + "gcc" +
Slash + XtensaGCCToolchain.GCCToolchainName + Slash +
- XtensaGCCToolchain.GCCLibAndIncVersion;
+ XtensaGCCToolchain.GCCLibAndIncVersion + SelectedMultilib.gccSuffix();
getFilePaths().push_back(Libs);
Libs = XtensaGCCToolchain.GCCToolchainDir + Slash +
- XtensaGCCToolchain.GCCToolchainName + Slash + "lib";
+ XtensaGCCToolchain.GCCToolchainName + Slash + "lib" +
+ SelectedMultilib.gccSuffix();
getFilePaths().push_back(Libs);
}
--
2.40.1