[Lldb-commits] [lldb] [lldb][test] Do not link to the system stdlib (PR #164462)

via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 21 10:27:01 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Ebuka Ezike (da-viper)

<details>
<summary>Changes</summary>

On linux if you specify the an external libc++ and clang will still link to the system's libc++. This patch fixes that.

---
Full diff: https://github.com/llvm/llvm-project/pull/164462.diff


1 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/make/Makefile.rules (+5) 


``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index e72ffd1f030ec..1676fb3d4520c 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -386,6 +386,11 @@ ifeq (,$(filter 1, $(USE_LIBSTDCPP) $(USE_LIBCPP) $(USE_SYSTEM_STDLIB)))
     ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
       CXXFLAGS += -cxx-isystem $(LIBCPP_INCLUDE_TARGET_DIR)
     endif
+
+	# If `-nostdlib++` is not passed, clang will link to the system's stdlib.
+	ifeq ($(LDC), clang)
+		LDFLAGS += -nostdlib++ -nostdinc++
+	endif
     LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
   else
     USE_SYSTEM_STDLIB := 1

``````````

</details>


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


More information about the lldb-commits mailing list