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

Louis Dionne via libc-commits libc-commits at lists.llvm.org
Fri Oct 13 10:59:47 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")
----------------
ldionne wrote:

So it's OK to remove that `/nodefaultlib` and `/Zl` or should we look into building with that again? (Preferably in a separate patch since this is a pre-existing condition)

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


More information about the libc-commits mailing list