Skip to content

Commit 1257cea

Browse files
qinkunbaopcc
authored andcommitted
Rebase
Created using spr 1.3.6-beta.1
2 parents 4b0017b + 79a2eee commit 1257cea

File tree

6 files changed

+26
-58
lines changed

6 files changed

+26
-58
lines changed

libcxx/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,11 @@ set(LIBCXX_LIBRARY_VERSION "${LIBCXX_ABI_VERSION}.0" CACHE STRING
209209
For example, -DLIBCXX_LIBRARY_VERSION=x.y will result in the library being named
210210
libc++.x.y.dylib, along with the usual symlinks pointing to that. On Apple platforms,
211211
this also controls the linker's 'current_version' property.")
212-
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.")
212+
set(default_abi_namespace "__${LIBCXX_ABI_VERSION}")
213+
if(NOT LIBCXX_PFP STREQUAL "none")
214+
set(default_abi_namespace "${default_abi_namespace}_pfp_${LIBCXX_PFP}")
215+
endif()
216+
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.")
213217
if (NOT LIBCXX_ABI_NAMESPACE MATCHES "__.*")
214218
message(FATAL_ERROR "LIBCXX_ABI_NAMESPACE must be a reserved identifier, got '${LIBCXX_ABI_NAMESPACE}'.")
215219
endif()
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
2+
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
3+
set(LIBCXX_PFP "tagged" CACHE STRING "")
4+
set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
5+
set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "")
6+
set(LIBCXX_TEST_CONFIG "llvm-libc++-static.cfg.in" CACHE STRING "")
7+
set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")

libcxx/docs/CodingGuidelines.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,12 @@ Pointer field protection
200200
========================
201201

202202
To improve the effectiveness of Clang's `pointer field protection
203-
<https://clang.llvm.org/docs/StructureProtection.html>`_ feature,
204-
commonly used vocabulary types with pointer fields are marked with the
205-
``_LIBCPP_PFP`` attribute, to give Clang permission to use PFP to protect
206-
their pointer fields. Newly added vocabulary types should be marked with
207-
this attribute if they contain pointer fields.
203+
<https://clang.llvm.org/docs/StructureProtection.html>`_ feature, commonly
204+
used vocabulary types, or internal base classes or fields thereof,
205+
with pointer fields are marked with the ``_LIBCPP_PFP`` attribute, to
206+
give Clang permission to use PFP to protect their pointer fields. Newly
207+
added vocabulary types and their internal base classes or fields should
208+
be marked with this attribute if they contain pointer fields.
208209

209210
For the time being, PFP is an experimental feature, so our criteria for
210211
marking types with ``_LIBCPP_PFP`` may change.

libcxx/include/__config

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -484,21 +484,8 @@ typedef __char32_t char32_t;
484484
# define _LIBCPP_EXCEPTIONS_SIG e
485485
# endif
486486

487-
# if !_LIBCPP_HAS_EXCEPTIONS
488-
# define _LIBCPP_EXCEPTIONS_SIG n
489-
# else
490-
# define _LIBCPP_EXCEPTIONS_SIG e
491-
# endif
492-
493-
# if defined(__POINTER_FIELD_PROTECTION__)
494-
# define _LIBCPP_PFP_SIG p
495-
# else
496-
# define _LIBCPP_PFP_SIG
497-
# endif
498-
499487
# define _LIBCPP_ODR_SIGNATURE \
500-
_LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_EXCEPTIONS_SIG), _LIBCPP_PFP_SIG), \
501-
_LIBCPP_VERSION)
488+
_LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_EXCEPTIONS_SIG), _LIBCPP_VERSION)
502489

503490
// This macro marks a symbol as being hidden from libc++'s ABI. This is achieved
504491
// on two levels:

libcxx/include/string

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ private:
825825

826826
# ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
827827

828-
struct __long {
828+
struct _LIBCPP_PFP __long {
829829
__long() = default;
830830

831831
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __long(__alloc_result __alloc, size_type __size)
@@ -879,7 +879,7 @@ private:
879879
// previous definition that did not use bit fields. This is because on
880880
// some platforms bit fields have a default size rather than the actual
881881
// size used, e.g., it is 4 bytes on AIX. See D128285 for details.
882-
struct __long {
882+
struct _LIBCPP_PFP __long {
883883
__long() = default;
884884

885885
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __long(__alloc_result __alloc, size_type __size)

libcxx/utils/ci/run-buildbot

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,11 @@ generic-ubsan)
376376
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake"
377377
check-runtimes
378378
;;
379+
generic-pfp)
380+
clean
381+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-pfp.cmake"
382+
check-runtimes
383+
;;
379384
#
380385
# Various build configurations
381386
#
@@ -411,42 +416,6 @@ bootstrapping-build)
411416

412417
ccache -s
413418
;;
414-
bootstrapping-build-pfp)
415-
clean
416-
417-
triple="$(${CXX} --print-target-triple)"
418-
419-
step "Generating CMake"
420-
${CMAKE} \
421-
-S "${MONOREPO_ROOT}/llvm" \
422-
-B "${BUILD_DIR}" \
423-
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
424-
-DCMAKE_BUILD_TYPE=Release \
425-
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
426-
-DLLVM_ENABLE_PROJECTS="clang;lld" \
427-
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
428-
-DLLVM_RUNTIME_TARGETS="$triple" \
429-
-DLLVM_HOST_TRIPLE="$triple" \
430-
-DLLVM_TARGETS_TO_BUILD="host" \
431-
-DRUNTIMES_BUILD_ALLOW_DARWIN=ON \
432-
-DLLVM_ENABLE_ASSERTIONS=ON \
433-
"-DRUNTIMES_${triple}_LIBCXXABI_ENABLE_SHARED=OFF" \
434-
"-DRUNTIMES_${triple}_LIBCXX_USE_COMPILER_RT=ON" \
435-
"-DRUNTIMES_${triple}_LIBCXX_PFP=tagged" \
436-
"-DRUNTIMES_${triple}_LIBCXX_ENABLE_SHARED=OFF" \
437-
"-DRUNTIMES_${triple}_LIBCXX_TEST_CONFIG=llvm-libc++-static.cfg.in" \
438-
"-DRUNTIMES_${triple}_LIBUNWIND_ENABLE_SHARED=OFF" \
439-
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
440-
441-
# FIXME: Currently this also runs the sanitizer tests due to compiler-rt
442-
# being in LLVM_ENABLE_RUNTIMES for the emulated PAC runtime. Ideally this
443-
# would only run the libc++ and libc++abi tests.
444-
step "Running the libc++ and libc++abi tests"
445-
${NINJA} -vC "${BUILD_DIR}" check-runtimes
446-
447-
# FIXME: Debugging support for PFP is incomplete so don't run the LLDB tests
448-
# as above for now.
449-
;;
450419
generic-static)
451420
clean
452421
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake"

0 commit comments

Comments
 (0)