[clang] 12b87f6 - [Driver] Silence stdlib warning when linking C on FreeBSD (#68011)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 11 09:28:09 PDT 2023


Author: dankm
Date: 2023-10-11T12:28:04-04:00
New Revision: 12b87f6ef720080fab1e2d48ca2d8c5ba478ee5d

URL: https://github.com/llvm/llvm-project/commit/12b87f6ef720080fab1e2d48ca2d8c5ba478ee5d
DIFF: https://github.com/llvm/llvm-project/commit/12b87f6ef720080fab1e2d48ca2d8c5ba478ee5d.diff

LOG: [Driver] Silence stdlib warning when linking C on FreeBSD (#68011)

Similar to the Gnu toolchain, ignore uses of '-stdlib=libc++' when
linking C code. CMake insists on adding it to the command line when
linking C, and a bunch of other build systems do similarly.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/FreeBSD.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index ff4d94c56f0d0ff..4d998e884f8ad42 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -356,6 +356,9 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
 
   ToolChain.addProfileRTLibs(Args, CmdArgs);
 
+  // Silence warnings when linking C code with a C++ '-stdlib' argument.
+  Args.ClaimAllArgs(options::OPT_stdlib_EQ);
+
   const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
   C.addCommand(std::make_unique<Command>(JA, *this,
                                          ResponseFileSupport::AtFileCurCP(),


        


More information about the cfe-commits mailing list