1 diff --git a/lib/Driver/ToolChains/BareMetal.cpp b/lib/Driver/ToolChains/BareMetal.cpp
2 index 852e0442..eb84a785 100644
3 --- a/lib/Driver/ToolChains/BareMetal.cpp
4 +++ b/lib/Driver/ToolChains/BareMetal.cpp
5 @@ -169,6 +169,12 @@ static bool isPPCBareMetal(const llvm::Triple &Triple) {
6 Triple.getEnvironment() == llvm::Triple::EABI;
9 +/// Is the triple x86_32 or x86_64 -*-none-elf?
10 +static bool isX86BareMetal(const llvm::Triple &Triple) {
11 + return Triple.isX86() && Triple.getOS() == llvm::Triple::UnknownOS &&
12 + Triple.getEnvironmentName() == "elf";
15 static void findMultilibsFromYAML(const ToolChain &TC, const Driver &D,
16 StringRef MultilibPath, const ArgList &Args,
17 DetectedMultilibs &Result) {
18 @@ -234,9 +240,10 @@ void BareMetal::findMultilibs(const Driver &D, const llvm::Triple &Triple,
20 bool BareMetal::handlesTarget(const llvm::Triple &Triple) {
21 return isARMBareMetal(Triple) || isAArch64BareMetal(Triple) ||
22 - isRISCVBareMetal(Triple) || isPPCBareMetal(Triple);
23 + isRISCVBareMetal(Triple) || isPPCBareMetal(Triple) || isX86BareMetal(Triple);
27 Tool *BareMetal::buildLinker() const {
28 return new tools::baremetal::Linker(*this);