Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libcxx] Option to disable overridden function detection #108734

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
to provide compile-time errors when using features unavailable on some version of
the shared library they shipped should turn this on and see `include/__configuration/availability.h`
for more details." OFF)
option(LIBCXX_ENABLE_OVERRIDDEN_FUNCTION_DETECTION
"Whether to support detecting if an overridable function (typically a weak symbol)
has been overidden by a user or not." ON)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-gcc.cfg.in")
Expand Down Expand Up @@ -763,6 +766,7 @@ config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE)
config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTERS)
config_define_if_not(LIBCXX_ENABLE_TIME_ZONE_DATABASE _LIBCPP_HAS_NO_TIME_ZONE_DATABASE)
config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
config_define_if_not(LIBCXX_ENABLE_OVERRIDDEN_FUNCTION_DETECTION _LIBCPP_HAS_NO_OVERRIDDEN_FUNCTION_DETECTION)

if (LIBCXX_ENABLE_ASSERTIONS)
message(DEPRECATION "LIBCXX_ENABLE_ASSERTIONS is deprecated and will be removed in LLVM 20. Please use LIBCXX_HARDENING_MODE instead.")
Expand Down
1 change: 1 addition & 0 deletions libcxx/include/__config_site.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#cmakedefine _LIBCPP_HAS_THREAD_API_WIN32
#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
#cmakedefine _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
#cmakedefine _LIBCPP_HAS_NO_OVERRIDDEN_FUNCTION_DETECTION
#cmakedefine _LIBCPP_NO_VCRUNTIME
#cmakedefine _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION @_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION@
#cmakedefine _LIBCPP_HAS_NO_FILESYSTEM
Expand Down
4 changes: 2 additions & 2 deletions libcxx/src/include/overridable_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
// want to be defining special sections inside user's executables which use our headers.
//

#if defined(_LIBCPP_OBJECT_FORMAT_MACHO)
#if defined(_LIBCPP_OBJECT_FORMAT_MACHO) && !defined(_LIBCPP_HAS_NO_OVERRIDDEN_FUNCTION_DETECTION)

# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
# define _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE \
Expand Down Expand Up @@ -97,7 +97,7 @@ _LIBCPP_HIDE_FROM_ABI bool __is_function_overridden(_Ret (*__fptr)(_Args...)) no
_LIBCPP_END_NAMESPACE_STD

// The NVPTX linker cannot create '__start/__stop' sections.
#elif defined(_LIBCPP_OBJECT_FORMAT_ELF) && !defined(__NVPTX__)
#elif defined(_LIBCPP_OBJECT_FORMAT_ELF) && !defined(__NVPTX__) && !defined(_LIBCPP_HAS_NO_OVERRIDDEN_FUNCTION_DETECTION)

# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
# define _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE __attribute__((__section__("__lcxx_override")))
Expand Down
Loading