[clang] [Driver] Normalize the baremetal handling of libc++ and runtimes (PR #101259)
Peter Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 1 07:10:25 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");
----------------
smithp35 wrote:
Yes I can confirm that leaving out -lc++abi does cause build failures with our C++ samples with undefined symbols from libc++abi.
The lld command (paths shortened for brevity) coming out of `clang++ --target=armv6m-none-eabi -march=armv6m -mfpu=none -mfloat-abi=soft -lcrt0-semihost -lsemihost -g -T ../../ldscripts/microbit.ld -o hello-exn.elf hello-exn.cpp`
```
"bin/ld.lld" -lcrt0-semihost -lsemihost /tmp/hello-exn-5244ae.o -Bstatic -EL -T ../../ldscripts/microbit.ld -Lbin/../lib/clang-runtimes/arm-none-eabi/armv6m_soft_nofp_exn_rtti/lib -Llib/clang/20/lib/armv6m-unknown-none-eabi -Lbin/../lib/clang-runtimes/arm-none-eabi/armv6m_soft_nofp_exn_rtti/lib -lc++ -lm b\
in/../lib/clang-runtimes/arm-none-eabi/armv6m_soft_nofp_exn_rtti/lib/libclang_rt.builtins.a -lc --target2=rel -o hello-exn.elf
ld.lld: error: undefined symbol: operator new(unsigned int)
...
ld.lld: error: undefined symbol: __cxa_allocate_exception
...
```
https://github.com/llvm/llvm-project/pull/101259
More information about the cfe-commits
mailing list