[libcxx-commits] [libcxx] [libc++] Update a comment about -nostdlib++ (PR #67429)

Nico Weber via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 26 06:31:21 PDT 2023


https://github.com/nico created https://github.com/llvm/llvm-project/pull/67429

GCC added support for the flag in gcc 13.1.

No behavior change.

>From aaf78a11f7d43036553a5ac693b6bd391f39711d Mon Sep 17 00:00:00 2001
From: Nico Weber <thakis at chromium.org>
Date: Tue, 26 Sep 2023 09:24:53 -0400
Subject: [PATCH] [libc++] Update a comment about -nostdlib++

GCC added support for the flag in gcc 13.1.

No behavior change.
---
 libcxx/CMakeLists.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index b9d0ed51be26033..c42337fa83062f7 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -624,9 +624,11 @@ 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
+# Unfortunately this cannot be used universally because g++ does not support
+# -nostdlib++ before gcc 13 (https://gcc.gnu.org/gcc-13/changes.html) and needs
+# to use -nodefaultlibs in which case all libraries will be removed and
 # all libraries but c++ have to be added in manually.
+# Once libc++ requires gcc 13+, this can be simplified.
   if (CXX_SUPPORTS_NOSTDLIBXX_FLAG)
     target_add_link_flags_if_supported(${target} PRIVATE "-nostdlib++")
   else()



More information about the libcxx-commits mailing list