<commit_before>add_compiler_rt_component(scudo)

include_directories(..)

set(SCUDO_CFLAGS ${SANITIZER_COMMON_CFLAGS})
# SANITIZER_COMMON_CFLAGS include -fno-builtin, but we actually want builtins!
list(APPEND SCUDO_CFLAGS -fbuiltin)
append_rtti_flag(OFF SCUDO_CFLAGS)

set(SCUDO_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})

# Use gc-sections by default to avoid unused code being pulled in.
list(APPEND SCUDO_CFLAGS -ffunction-sections -fdata-sections)
list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,--gc-sections)

set(SCUDO_SOURCES
  scudo_allocator.cpp
  scudo_crc32.cpp
  scudo_flags.cpp
  scudo_malloc.cpp
  scudo_termination.cpp
  scudo_tsd_exclusive.cpp
  scudo_tsd_shared.cpp
  scudo_utils.cpp)

set(SCUDO_CXX_SOURCES
  scudo_new_delete.cpp)

# Enable the SSE 4.2 instruction set for scudo_crc32.cpp, if available.
if (COMPILER_RT_HAS_MSSE4_2_FLAG)
  set_source_files_properties(scudo_crc32.cpp PROPERTIES COMPILE_FLAGS -msse4.2)
endif()

# Enable the AArch64 CRC32 feature for scudo_crc32.cpp, if available.
# Note that it is enabled by default starting with armv8.1-a.
if (COMPILER_RT_HAS_MCRC_FLAG)
  set_source_files_properties(scudo_crc32.cpp PROPERTIES COMPILE_FLAGS -mcrc)
endif()

if(COMPILER_RT_HAS_SCUDO)
  set(SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY}
                         ${SANITIZER_COMMON_LINK_LIBS})
  append_list_if(COMPILER_RT_HAS_LIBDL dl SCUDO_DYNAMIC_LIBS)
  append_list_if(COMPILER_RT_HAS_LIBRT rt SCUDO_DYNAMIC_LIBS)
  append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread SCUDO_DYNAMIC_LIBS)
  append_list_if(COMPILER_RT_HAS_LIBLOG log SCUDO_DYNAMIC_LIBS)

  add_compiler_rt_runtime(clang_rt.scudo
    STATIC
    ARCHS ${SCUDO_SUPPORTED_ARCH}
    SOURCES ${SCUDO_SOURCES}
    OBJECT_LIBS RTSanitizerCommonNoTermination
                RTSanitizerCommonLibc
                RTSanitizerCommonCoverage
                RTInterception
                RTUbsan
    CFLAGS ${SCUDO_CFLAGS}
    PARENT_TARGET scudo)

  add_compiler_rt_runtime(clang_rt.scudo_cxx
    STATIC
    ARCHS ${SCUDO_SUPPORTED_ARCH}
    SOURCES ${SCUDO_CXX_SOURCES}
    OBJECT_LIBS RTUbsan_cxx
    CFLAGS ${SCUDO_CFLAGS}
    PARENT_TARGET scudo)

  add_compiler_rt_runtime(clang_rt.scudo
    SHARED
    ARCHS ${SCUDO_SUPPORTED_ARCH}
    SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES}
    OBJECT_LIBS RTSanitizerCommonNoTermination
                RTSanitizerCommonLibc
                RTSanitizerCommonCoverage
                RTInterception
                RTUbsan
                RTUbsan_cxx
    CFLAGS ${SCUDO_CFLAGS}
    LINK_FLAGS ${SCUDO_DYNAMIC_LINK_FLAGS}
    LINK_LIBS ${SCUDO_DYNAMIC_LIBS}
    PARENT_TARGET scudo)
endif()<commit_msg>[scudo] Fuchsia minimal shared runtime<commit_after>add_compiler_rt_component(scudo)

include_directories(..)

set(SCUDO_CFLAGS ${SANITIZER_COMMON_CFLAGS})
# SANITIZER_COMMON_CFLAGS include -fno-builtin, but we actually want builtins!
list(APPEND SCUDO_CFLAGS -fbuiltin -ffunction-sections -fdata-sections)
append_rtti_flag(OFF SCUDO_CFLAGS)

set(SCUDO_DYNAMIC_LIBS ${SANITIZER_COMMON_LINK_LIBS})
append_list_if(COMPILER_RT_HAS_LIBDL dl SCUDO_DYNAMIC_LIBS)
append_list_if(COMPILER_RT_HAS_LIBRT rt SCUDO_DYNAMIC_LIBS)
append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread SCUDO_DYNAMIC_LIBS)
append_list_if(COMPILER_RT_HAS_LIBLOG log SCUDO_DYNAMIC_LIBS)

set(SCUDO_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
# Use gc-sections by default to avoid unused code being pulled in.
list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -Wl,--gc-sections)

set(SCUDO_OBJECT_LIBS
  RTSanitizerCommonNoTermination
  RTSanitizerCommonLibc
  RTInterception)

if (FUCHSIA)
  list(APPEND SCUDO_CFLAGS -nostdinc++)
  list(APPEND SCUDO_DYNAMIC_LINK_FLAGS -nostdlib++)
  # TODO(kostyak): remove when stacktraces are split off of RTSanitizerCommon
  list(APPEND SCUDO_DYNAMIC_LIBS unwind_shared)
else()
  list(APPEND SCUDO_OBJECT_LIBS RTSanitizerCommonCoverage RTUbsan)
  list(APPEND SCUDO_DYNAMIC_LIBS ${SANITIZER_CXX_ABI_LIBRARY})
endif()

set(SCUDO_SOURCES
  scudo_allocator.cpp
  scudo_crc32.cpp
  scudo_flags.cpp
  scudo_malloc.cpp
  scudo_termination.cpp
  scudo_tsd_exclusive.cpp
  scudo_tsd_shared.cpp
  scudo_utils.cpp)

set(SCUDO_CXX_SOURCES
  scudo_new_delete.cpp)

# Enable the SSE 4.2 instruction set for scudo_crc32.cpp, if available.
if (COMPILER_RT_HAS_MSSE4_2_FLAG)
  set_source_files_properties(scudo_crc32.cpp PROPERTIES COMPILE_FLAGS -msse4.2)
endif()

# Enable the AArch64 CRC32 feature for scudo_crc32.cpp, if available.
# Note that it is enabled by default starting with armv8.1-a.
if (COMPILER_RT_HAS_MCRC_FLAG)
  set_source_files_properties(scudo_crc32.cpp PROPERTIES COMPILE_FLAGS -mcrc)
endif()

if(COMPILER_RT_HAS_SCUDO)
  add_compiler_rt_runtime(clang_rt.scudo
    STATIC
    ARCHS ${SCUDO_SUPPORTED_ARCH}
    SOURCES ${SCUDO_SOURCES}
    OBJECT_LIBS ${SCUDO_OBJECT_LIBS}
    CFLAGS ${SCUDO_CFLAGS}
    PARENT_TARGET scudo)

  add_compiler_rt_runtime(clang_rt.scudo_cxx
    STATIC
    ARCHS ${SCUDO_SUPPORTED_ARCH}
    SOURCES ${SCUDO_CXX_SOURCES}
    OBJECT_LIBS RTUbsan_cxx
    CFLAGS ${SCUDO_CFLAGS}
    PARENT_TARGET scudo)

  add_compiler_rt_runtime(clang_rt.scudo
    SHARED
    ARCHS ${SCUDO_SUPPORTED_ARCH}
    SOURCES ${SCUDO_SOURCES} ${SCUDO_CXX_SOURCES}
    OBJECT_LIBS ${SCUDO_OBJECT_LIBS}
    CFLAGS ${SCUDO_CFLAGS}
    LINK_FLAGS ${SCUDO_DYNAMIC_LINK_FLAGS}
    LINK_LIBS ${SCUDO_DYNAMIC_LIBS}
    PARENT_TARGET scudo)
endif()
{'fraction_non_alphanumeric': 0.0631618056845625, 'fraction_numerical': 0.008173880735649267, 'mean_word_length': 5.181400688863375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3915900', 'n_tokens_mistral': 2311, 'n_tokens_neox': 2168, 'n_words': 340}