diff options
| author | Qinkun Bao <qinkun@google.com> | 2025-10-10 16:12:37 -0700 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2025-10-10 16:12:37 -0700 |
| commit | 1257ceaaedda8e17fc5802935f72c637fb575889 (patch) | |
| tree | 3061c24d727fcfbee2a45dd136780a378a19e5d1 | |
| parent | 4b0017bd88d67150f9b214c51214e022ec72f098 (diff) | |
| parent | 79a2eeebf025c6211ac130664bd2882344373274 (diff) | |
Created using spr 1.3.6-beta.1
| -rw-r--r-- | libcxx/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | libcxx/cmake/caches/Generic-pfp.cmake | 7 | ||||
| -rw-r--r-- | libcxx/docs/CodingGuidelines.rst | 11 | ||||
| -rw-r--r-- | libcxx/include/__config | 15 | ||||
| -rw-r--r-- | libcxx/include/string | 4 | ||||
| -rwxr-xr-x | libcxx/utils/ci/run-buildbot | 41 |
6 files changed, 26 insertions, 58 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index 73cfe505efe3..bb179f8127d2 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -209,7 +209,11 @@ set(LIBCXX_LIBRARY_VERSION "${LIBCXX_ABI_VERSION}.0" CACHE STRING For example, -DLIBCXX_LIBRARY_VERSION=x.y will result in the library being named libc++.x.y.dylib, along with the usual symlinks pointing to that. On Apple platforms, this also controls the linker's 'current_version' property.") -set(LIBCXX_ABI_NAMESPACE "__${LIBCXX_ABI_VERSION}" CACHE STRING "The inline ABI namespace used by libc++. It defaults to __n where `n` is the current ABI version.") +set(default_abi_namespace "__${LIBCXX_ABI_VERSION}") +if(NOT LIBCXX_PFP STREQUAL "none") + set(default_abi_namespace "${default_abi_namespace}_pfp_${LIBCXX_PFP}") +endif() +set(LIBCXX_ABI_NAMESPACE "${default_abi_namespace}" CACHE STRING "The inline ABI namespace used by libc++. It defaults to __n where `n` is the current ABI version.") if (NOT LIBCXX_ABI_NAMESPACE MATCHES "__.*") message(FATAL_ERROR "LIBCXX_ABI_NAMESPACE must be a reserved identifier, got '${LIBCXX_ABI_NAMESPACE}'.") endif() diff --git a/libcxx/cmake/caches/Generic-pfp.cmake b/libcxx/cmake/caches/Generic-pfp.cmake new file mode 100644 index 000000000000..1a25e6a8ac7f --- /dev/null +++ b/libcxx/cmake/caches/Generic-pfp.cmake @@ -0,0 +1,7 @@ +set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "") +set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") +set(LIBCXX_PFP "tagged" CACHE STRING "") +set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "") +set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") +set(LIBCXX_TEST_CONFIG "llvm-libc++-static.cfg.in" CACHE STRING "") +set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "") diff --git a/libcxx/docs/CodingGuidelines.rst b/libcxx/docs/CodingGuidelines.rst index 0a1ab136c460..9253456b7358 100644 --- a/libcxx/docs/CodingGuidelines.rst +++ b/libcxx/docs/CodingGuidelines.rst @@ -200,11 +200,12 @@ Pointer field protection ======================== To improve the effectiveness of Clang's `pointer field protection -<https://clang.llvm.org/docs/StructureProtection.html>`_ feature, -commonly used vocabulary types with pointer fields are marked with the -``_LIBCPP_PFP`` attribute, to give Clang permission to use PFP to protect -their pointer fields. Newly added vocabulary types should be marked with -this attribute if they contain pointer fields. +<https://clang.llvm.org/docs/StructureProtection.html>`_ feature, commonly +used vocabulary types, or internal base classes or fields thereof, +with pointer fields are marked with the ``_LIBCPP_PFP`` attribute, to +give Clang permission to use PFP to protect their pointer fields. Newly +added vocabulary types and their internal base classes or fields should +be marked with this attribute if they contain pointer fields. For the time being, PFP is an experimental feature, so our criteria for marking types with ``_LIBCPP_PFP`` may change. diff --git a/libcxx/include/__config b/libcxx/include/__config index 933f5ff93161..4dd513e09276 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -484,21 +484,8 @@ typedef __char32_t char32_t; # define _LIBCPP_EXCEPTIONS_SIG e # endif -# if !_LIBCPP_HAS_EXCEPTIONS -# define _LIBCPP_EXCEPTIONS_SIG n -# else -# define _LIBCPP_EXCEPTIONS_SIG e -# endif - -# if defined(__POINTER_FIELD_PROTECTION__) -# define _LIBCPP_PFP_SIG p -# else -# define _LIBCPP_PFP_SIG -# endif - # define _LIBCPP_ODR_SIGNATURE \ - _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_EXCEPTIONS_SIG), _LIBCPP_PFP_SIG), \ - _LIBCPP_VERSION) + _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_EXCEPTIONS_SIG), _LIBCPP_VERSION) // This macro marks a symbol as being hidden from libc++'s ABI. This is achieved // on two levels: diff --git a/libcxx/include/string b/libcxx/include/string index 363f27a51648..fbed735829f7 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -825,7 +825,7 @@ private: # ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT - struct __long { + struct _LIBCPP_PFP __long { __long() = default; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __long(__alloc_result __alloc, size_type __size) @@ -879,7 +879,7 @@ private: // previous definition that did not use bit fields. This is because on // some platforms bit fields have a default size rather than the actual // size used, e.g., it is 4 bytes on AIX. See D128285 for details. - struct __long { + struct _LIBCPP_PFP __long { __long() = default; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __long(__alloc_result __alloc, size_type __size) diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot index 9965ebe78b49..4f7d4dd547e1 100755 --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -376,6 +376,11 @@ generic-ubsan) generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake" check-runtimes ;; +generic-pfp) + clean + generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-pfp.cmake" + check-runtimes +;; # # Various build configurations # @@ -411,42 +416,6 @@ bootstrapping-build) ccache -s ;; -bootstrapping-build-pfp) - clean - - triple="$(${CXX} --print-target-triple)" - - step "Generating CMake" - ${CMAKE} \ - -S "${MONOREPO_ROOT}/llvm" \ - -B "${BUILD_DIR}" \ - -GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ - -DLLVM_ENABLE_PROJECTS="clang;lld" \ - -DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \ - -DLLVM_RUNTIME_TARGETS="$triple" \ - -DLLVM_HOST_TRIPLE="$triple" \ - -DLLVM_TARGETS_TO_BUILD="host" \ - -DRUNTIMES_BUILD_ALLOW_DARWIN=ON \ - -DLLVM_ENABLE_ASSERTIONS=ON \ - "-DRUNTIMES_${triple}_LIBCXXABI_ENABLE_SHARED=OFF" \ - "-DRUNTIMES_${triple}_LIBCXX_USE_COMPILER_RT=ON" \ - "-DRUNTIMES_${triple}_LIBCXX_PFP=tagged" \ - "-DRUNTIMES_${triple}_LIBCXX_ENABLE_SHARED=OFF" \ - "-DRUNTIMES_${triple}_LIBCXX_TEST_CONFIG=llvm-libc++-static.cfg.in" \ - "-DRUNTIMES_${triple}_LIBUNWIND_ENABLE_SHARED=OFF" \ - -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" - - # FIXME: Currently this also runs the sanitizer tests due to compiler-rt - # being in LLVM_ENABLE_RUNTIMES for the emulated PAC runtime. Ideally this - # would only run the libc++ and libc++abi tests. - step "Running the libc++ and libc++abi tests" - ${NINJA} -vC "${BUILD_DIR}" check-runtimes - - # FIXME: Debugging support for PFP is incomplete so don't run the LLDB tests - # as above for now. -;; generic-static) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake" |
