Skip to content

Commit 1562689

Browse files
da-viperDebadri Basak
authored andcommitted
[lldb][test] When an external stdlib is specified do not link to the system stdlib (llvm#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 llvm#116040
1 parent 95783bc commit 1562689

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@ ifeq (,$(filter 1, $(USE_LIBSTDCPP) $(USE_LIBCPP) $(USE_SYSTEM_STDLIB)))
386386
ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
387387
CXXFLAGS += -cxx-isystem $(LIBCPP_INCLUDE_TARGET_DIR)
388388
endif
389-
LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
389+
390+
# If `-nostdlib++` is not passed, clang will link to the system's stdlib.
391+
LDFLAGS += -nostdlib++ -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
390392
else
391393
USE_SYSTEM_STDLIB := 1
392394
endif
@@ -407,7 +409,8 @@ ifeq (1,$(USE_LIBCPP))
407409
ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
408410
CXXFLAGS += -cxx-isystem $(LIBCPP_INCLUDE_TARGET_DIR)
409411
endif
410-
LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
412+
# If `-nostdlib++` is not passed, clang will link to the system's stdlib.
413+
LDFLAGS += -nostdlib++ -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
411414
else
412415
ifeq "$(OS)" "Android"
413416
# Nothing to do, this is already handled in

0 commit comments

Comments
 (0)