lichray created this revision.
Herald added subscribers: krytarowski, arichardson, emaste.
lichray requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When targeting FreeBSD on a Linux host with a copy
of system libc++, Clang prepends /usr/include/c++/v1
to the search paths even with -ffreestanding, and
fails to compile a program with a
single #include <xmmintrin.h>

The proposed change fixes this issue.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114497

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2872,7 +2872,7 @@
 void Generic_GCC::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
                                                ArgStringList &CC1Args) const {
   if (DriverArgs.hasArg(options::OPT_nostdinc, options::OPT_nostdincxx,
-                        options::OPT_nostdlibinc))
+                        options::OPT_nostdlibinc, options::OPT_ffreestanding))
     return;
 
   switch (GetCXXStdlibType(DriverArgs)) {


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2872,7 +2872,7 @@
 void Generic_GCC::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
                                                ArgStringList &CC1Args) const {
   if (DriverArgs.hasArg(options::OPT_nostdinc, options::OPT_nostdincxx,
-                        options::OPT_nostdlibinc))
+                        options::OPT_nostdlibinc, options::OPT_ffreestanding))
     return;
 
   switch (GetCXXStdlibType(DriverArgs)) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to