[clang] [Driver] Normalize the baremetal handling of libc++ and runtimes (PR #101259)

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 10:00:01 PDT 2024


================
@@ -382,38 +382,6 @@ void BareMetal::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
   }
 }
 
-void BareMetal::AddCXXStdlibLibArgs(const ArgList &Args,
-                                    ArgStringList &CmdArgs) const {
-  switch (GetCXXStdlibType(Args)) {
-  case ToolChain::CST_Libcxx:
-    CmdArgs.push_back("-lc++");
-    if (Args.hasArg(options::OPT_fexperimental_library))
-      CmdArgs.push_back("-lc++experimental");
-    CmdArgs.push_back("-lc++abi");
----------------
petrhosek wrote:

> spits out a libc++ linker script fragment (my preference)

We already have this and it's used on platforms like Darwin, Fuchsia or Linux:

https://github.com/llvm/llvm-project/blob/3d08ade7bd32f0296e0ca3a13640cc95fa89229a/libcxx/CMakeLists.txt#L269-L271

> merge libc++ and libc++abi libraries (this should work as long as libc++abi's objects are inserted after libc++)

We already have this and it's what we've been using in our baremetal build for example:

https://github.com/llvm/llvm-project/blob/3d08ade7bd32f0296e0ca3a13640cc95fa89229a/libcxx/CMakeLists.txt#L247-L253

https://github.com/llvm/llvm-project/pull/101259


More information about the cfe-commits mailing list