[PATCH] D114497: [Driver] Stop adding stdlib paths in -ffreestanding

Zhihao Yuan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 23 20:26:55 PST 2021


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)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114497.389382.patch
Type: text/x-patch
Size: 631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211124/d373eae3/attachment.bin>


More information about the cfe-commits mailing list