[lldb][test] When an external stdlib is specified do not link to the system stdlib (#164462)

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

Fixes https://github.com/llvm/llvm-project/issues/116040
This commit is contained in:
Ebuka Ezike 2025-10-28 13:33:22 +00:00 committed by GitHub
parent 44cb8c1e00
commit ec55aa4ef2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -386,7 +386,9 @@ ifeq (,$(filter 1, $(USE_LIBSTDCPP) $(USE_LIBCPP) $(USE_SYSTEM_STDLIB)))
ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
CXXFLAGS += -cxx-isystem $(LIBCPP_INCLUDE_TARGET_DIR)
endif
LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
# If `-nostdlib++` is not passed, clang will link to the system's stdlib.
LDFLAGS += -nostdlib++ -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
else
USE_SYSTEM_STDLIB := 1
endif
@ -407,7 +409,8 @@ ifeq (1,$(USE_LIBCPP))
ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
CXXFLAGS += -cxx-isystem $(LIBCPP_INCLUDE_TARGET_DIR)
endif
LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
# If `-nostdlib++` is not passed, clang will link to the system's stdlib.
LDFLAGS += -nostdlib++ -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
else
ifeq "$(OS)" "Android"
# Nothing to do, this is already handled in