From 38c0e64da50d88605728f26c5d9dd6fbbb84ec82 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 19 May 2021 17:56:03 -0700
Subject: [PATCH] clang: Fix x86 triple for non-debian multiarch linux distros

OpenEmbedded does not hardcode mutli-arch like debian therefore ensure
that it still uses the proper tuple

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 clang/lib/Driver/ToolChains/Linux.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index bb7270bb08ba..6354c4d06570 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -720,6 +720,9 @@ void Linux::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
       GCCInstallation.getTriple().getArch() == llvm::Triple::x86
           ? "i386-linux-gnu"
           : TripleStr;
+  // OpenEmbedded does not hardcode the triple to i386-linux-gnu like debian
+  if (GCCInstallation.getTriple().getVendor() == llvm::Triple::OpenEmbedded)
+	  DebianMultiarch = TripleStr;
 
   // Try generic GCC detection first.
   if (Generic_GCC::addGCCLibStdCxxIncludePaths(DriverArgs, CC1Args,
