diff options
author | Felipe de Azevedo Piovezan <fpiovezan@apple.com> | 2023-03-23 08:18:53 -0400 |
---|---|---|
committer | Felipe de Azevedo Piovezan <fpiovezan@apple.com> | 2023-03-23 11:53:13 -0400 |
commit | c640a146c4caa3cca559e308e2e7ecc78c45140d (patch) | |
tree | 98f554b4d5278ef6b068a51b0c72fea78138c060 /lldb/packages | |
parent | 85faee69928b1eeb74a0d74f374a1c74ddf236dd (diff) | |
download | llvm-c640a146c4caa3cca559e308e2e7ecc78c45140d.tar.gz |
[lldb] Explicitly set libcxx paths when USE_SYSTEM_STDLIB is provided
For tests marked as "USE_SYSTEM_STDLIB", the expectation is that the
system's standard library should be used. However, the implementation of
this flag is such that we simply don't pass _any_ libcxxx-related flags
to Clang; in turn, Clang will use its defaults.
For a Clang/Libcxx pair compiled together, Clang defaults to:
1. The headers of the sibling libcxx.
2. The libraries of the system.
This mismatch is actually a bug in the driver; once fixed, however, (2)
would point to the sibling libcxx as well, which is _not_ what test
authors intended with the USE_SYSTEM_STDLIB flag.
As such, this patch explicitly sets a path to the system's libraries.
This change is done only in Apple platforms so that we can test this
works in this case first.
Differential Revision: https://reviews.llvm.org/D146714
Diffstat (limited to 'lldb/packages')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/make/Makefile.rules | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index 25c4d8876332..4c225ed360be 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -428,6 +428,16 @@ ifeq (1,$(USE_LIBCPP)) endif endif +ifeq (1, $(USE_SYSTEM_STDLIB)) + ifeq "$(OS)" "Darwin" + ifeq "$(SDKROOT)" "" + $(error "SDKROOT must be set on Darwin to use the system libcxx") + endif + CXXFLAGS += -nostdlib++ -nostdinc++ -cxx-isystem $(SDKROOT)/usr/include/c++/v1 + LDFLAGS += -L$(SDKROOT)/usr/lib -Wl,-rpath,$(SDKROOT)/usr/lib -lc++ + endif +endif + # If no explicit request was made, but we have paths to a custom libcxx, use # them. ifeq ($(or $(USE_LIBSTDCPP), $(USE_LIBCPP), $(USE_SYSTEM_STDLIB)),) |