[clang] 82f6e0d - [Driver] -m32: Add /usr/include/i386-linux-gnu for Debian

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 22 01:27:11 PDT 2021


Author: Fangrui Song
Date: 2021-03-22T01:27:06-07:00
New Revision: 82f6e0dde29e6c6da27f64db5992eb539a57d21b

URL: https://github.com/llvm/llvm-project/commit/82f6e0dde29e6c6da27f64db5992eb539a57d21b
DIFF: https://github.com/llvm/llvm-project/commit/82f6e0dde29e6c6da27f64db5992eb539a57d21b.diff

LOG: [Driver] -m32: Add /usr/include/i386-linux-gnu for Debian

Added: 
    clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/i386-linux-gnu/.keep

Modified: 
    clang/lib/Driver/ToolChains/Linux.cpp
    clang/test/Driver/linux-cross.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index e889791d19b2..0df2d3793819 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -604,13 +604,8 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
     return;
   }
 
-  // On Android and Debian, add /usr/include/$triple if exists. On Debian, we
-  // can assume a GCC installation is available.
-  std::string MultiarchIncludeDir;
-  if (getTriple().isAndroid())
-    MultiarchIncludeDir = getMultiarchTriple(D, getTriple(), SysRoot);
-  else if (GCCInstallation.isValid())
-    MultiarchIncludeDir = GCCInstallation.getTriple().str();
+  // On Android and Debian, add /usr/include/$triple if exists.
+  std::string MultiarchIncludeDir = getMultiarchTriple(D, getTriple(), SysRoot);
   if (!MultiarchIncludeDir.empty() &&
       D.getVFS().exists(SysRoot + "/usr/include/" + MultiarchIncludeDir))
     addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include/" + MultiarchIncludeDir);

diff  --git a/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/i386-linux-gnu/.keep b/clang/test/Driver/Inputs/debian_multiarch_tree/usr/include/i386-linux-gnu/.keep
new file mode 100644
index 000000000000..e69de29bb2d1

diff  --git a/clang/test/Driver/linux-cross.cpp b/clang/test/Driver/linux-cross.cpp
index fa07d615f4fc..6fdd9193fa2f 100644
--- a/clang/test/Driver/linux-cross.cpp
+++ b/clang/test/Driver/linux-cross.cpp
@@ -34,6 +34,8 @@
 // DEBIAN_X86_64_M32-SAME: {{^}} "-internal-isystem" "[[SYSROOT:[^"]+]]/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward"
 // DEBIAN_X86_64_M32-SAME: {{^}} "-internal-isystem" "[[SYSROOT]]/usr/local/include"
 // DEBIAN_X86_64_M32-SAME: {{^}} "-internal-isystem" "[[SYSROOT:[^"]+]]/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include"
+// DEBIAN_X86_64_M32:      "-internal-externc-isystem"
+// DEBIAN_X86_64_M32-SAME: {{^}} "[[SYSROOT]]/usr/include/i386-linux-gnu"
 // DEBIAN_X86_64_M32:      "-L
 // DEBIAN_X86_64_M32-SAME: {{^}}[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/10/32"
 // DEBIAN_X86_64_M32-SAME: {{^}} "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib32"


        


More information about the cfe-commits mailing list