summaryrefslogtreecommitdiff
path: root/util/crossgcc/patches/clang-18.1.8.src_x86_baremetal.patch
blob: 61c608cbbe2ebf1920ab597eb6d6488ff49ba94b (plain)
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
diff --git a/lib/Driver/ToolChains/BareMetal.cpp b/lib/Driver/ToolChains/BareMetal.cpp
index 852e0442..eb84a785 100644
--- a/lib/Driver/ToolChains/BareMetal.cpp
+++ b/lib/Driver/ToolChains/BareMetal.cpp
@@ -169,6 +169,12 @@ static bool isPPCBareMetal(const llvm::Triple &Triple) {
          Triple.getEnvironment() == llvm::Triple::EABI;
 }

+/// Is the triple x86_32 or x86_64 -*-none-elf?
+static bool isX86BareMetal(const llvm::Triple &Triple) {
+  return Triple.isX86() && Triple.getOS() == llvm::Triple::UnknownOS &&
+    Triple.getEnvironmentName() == "elf";
+}
+
 static void findMultilibsFromYAML(const ToolChain &TC, const Driver &D,
                                   StringRef MultilibPath, const ArgList &Args,
                                   DetectedMultilibs &Result) {
@@ -234,9 +240,10 @@ void BareMetal::findMultilibs(const Driver &D, const llvm::Triple &Triple,

 bool BareMetal::handlesTarget(const llvm::Triple &Triple) {
   return isARMBareMetal(Triple) || isAArch64BareMetal(Triple) ||
-         isRISCVBareMetal(Triple) || isPPCBareMetal(Triple);
+    isRISCVBareMetal(Triple) || isPPCBareMetal(Triple) || isX86BareMetal(Triple);
 }

+
 Tool *BareMetal::buildLinker() const {
   return new tools::baremetal::Linker(*this);
 }