[clang] [libc++] Use -nostdlib++ on GCC unconditionally (PR #68832)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 13 11:49:18 PDT 2023


================
@@ -642,18 +642,8 @@ get_sanitizer_flags(SANITIZER_FLAGS "${LLVM_USE_SANITIZER}")
 
 # Link system libraries =======================================================
 function(cxx_link_system_libraries target)
-
-# In order to remove just libc++ from the link step
-# we need to use -nostdlib++ whenever it is supported.
-# Unfortunately this cannot be used universally because for example g++ supports
-# only -nodefaultlibs in which case all libraries will be removed and
-# all libraries but c++ have to be added in manually.
-  if (CXX_SUPPORTS_NOSTDLIBXX_FLAG)
-    target_add_link_flags_if_supported(${target} PRIVATE "-nostdlib++")
-  else()
-    target_add_link_flags_if_supported(${target} PRIVATE "-nodefaultlibs")
-    target_add_compile_flags_if_supported(${target} PRIVATE "/Zl")
-    target_add_link_flags_if_supported(${target} PRIVATE "/nodefaultlib")
----------------
mstorsjo wrote:

Yeah I think it's totally ok to remove. Whatever the setup was when those might have been needed on MSVC-like setups, they're not needed (or usable) currently - and our CI coverage is fairly good at the moment, I would say. So if this patch works, just go ahead!

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


More information about the cfe-commits mailing list