[libcxx-commits] [PATCH] D107560: [libc++][libc++abi][CET] Support building libc++ and libc++abi with CET enabled.
xiongji90 via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 11 00:56:18 PDT 2021
xiongji90 added a comment.
In D107560#2933130 <https://reviews.llvm.org/D107560#2933130>, @Mordante wrote:
>> This patch is used to build libc++ and libc++abi with CET enabled. If developers want to build applications with CET enabled and use libc++ and libc++abi, they must link CET enabled libc++ and libc++abi libraries. We introduce 2 options: LIBCXX_ENABLE_CET and LIBCXXABI_ENABLE_CET to enable CET building. This patch also enables running all libcxx and libcxxabi tests with CET enabled.
>
> I wonder what happens if only one of the two libraries is build with the flag enabled. Will these libraries still be compatible but with CET disabled? Or will they be incompatible?
Hi, @Mordante
Do you mean if we build libc+, libc++abi with CET enabled and use them in a non-CET environment? If so, they can still work. After applying "-fcf-protection=full", "endbr32/64" instruction will be added to the beginning of all functions, the "endbr32/64" instruction will be regarded as "nop" instruction in non-CET environment.
Thanks very much.
================
Comment at: libcxx/CMakeLists.txt:87
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." OFF)
+option(LIBCXX_ENABLE_CET "Build libc++ with CET enabled." OFF)
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
----------------
Mordante wrote:
> This needs more documentation. CET isn't a well known feature. Please also update `libcxx/docs/BuildingLibcxx.rst` regarding this feature. The comment for this patch already contains a lot of useful information, that I would like to see here.
Hi, @Mordante
Since we have not decided whether we need to add LIBCXX_ENABLE_CET option, it seems better for us to discuss and make final decision about the option firstly, if we finally decide to add this option, I will add some documentation as you required.
Thanks very much.
================
Comment at: libcxx/CMakeLists.txt:158
+if (LIBCXX_ENABLE_CET AND MSVC)
+ message(FATAL_ERROR "libc++ CET support is not available for MSVC!")
----------------
Mordante wrote:
> Can you also validate the build is on the x86 platform?
> Question regarding x86, do you mean the 32-bit platform or both the 32-bit and 64-bit platform.
> To me x86 means only the 32-bit platform.
Hi, @Mordante
"Can you also validate the build is on the x86 platform?"
Do you mean we need to check whether we are building the library on a x86 platform?
"Question regarding x86, do you mean the 32-bit platform or both the 32-bit and 64-bit platform."
Sorry for the confusion, I mean both 32-bit and 64-bit platform and I have tested both 32-bit and 64-bit.
Thanks very much.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107560/new/
https://reviews.llvm.org/D107560
More information about the libcxx-commits
mailing list