Skip to content
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
90 changes: 0 additions & 90 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,6 @@ endif()

set(GENERATE_CODE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/generated-src")

if(USE_CUSTOM_LIBCXX)
set(BORINGSSL_ALLOW_CXX_RUNTIME 1)
endif()

if(BORINGSSL_ALLOW_CXX_RUNTIME)
add_definitions(-DBORINGSSL_ALLOW_CXX_RUNTIME)
endif()
Expand Down Expand Up @@ -948,88 +944,10 @@ if(ENABLE_DATA_INDEPENDENT_TIMING)
add_definitions(-DENABLE_AUTO_SET_RESET_DIT)
endif()

if(USE_CUSTOM_LIBCXX)
if(NOT CLANG)
message(FATAL_ERROR "USE_CUSTOM_LIBCXX only supported with Clang")
endif()

# The docker images set an environment variable to the llvm project directory which the sandbox builds will use,
# you can also pass in the llvm project path as a CMake parameter which takes precedence over the environment variable
if(DEFINED ENV{LLVM_PROJECT_HOME} AND NOT LLVM_PROJECT_HOME)
set(LLVM_PROJECT_HOME $ENV{LLVM_PROJECT_HOME})
endif()

if(NOT LLVM_PROJECT_HOME)
message(FATAL "Could not find path to LLVM project, must set LLVM_PROJECT_HOME environment variable or pass in -DLLVM_PROJECT_HOME")
endif()

# CMAKE_CXX_FLAGS ends up in the linker flags as well, so use
# add_compile_options. There does not appear to be a way to set
# language-specific compile-only flags.
add_compile_options("-nostdinc++")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -nostdlib++")
include_directories(
SYSTEM
util/bot/libcxx-config
${LLVM_PROJECT_HOME}/libcxx/include
${LLVM_PROJECT_HOME}/libcxxabi/include
)

# This is patterned after buildtools/third_party/libc++/BUILD.gn and
# buildtools/third_party/libc++abi/BUILD.gn in Chromium.

file(GLOB LIBCXX_SOURCES "${LLVM_PROJECT_HOME}/libcxx/src/*.cpp" "${LLVM_PROJECT_HOME}/libcxx/src/ryu/*.cpp")
file(GLOB LIBCXXABI_SOURCES "${LLVM_PROJECT_HOME}/libcxxabi/src/*.cpp")

# This file is meant for exception-less builds.
list(REMOVE_ITEM LIBCXXABI_SOURCES "${LLVM_PROJECT_HOME}/libcxxabi/src/cxa_noexception.cpp")

# libc++ also defines new and delete.
list(REMOVE_ITEM LIBCXXABI_SOURCES "${LLVM_PROJECT_HOME}/libcxxabi/src/stdlib_new_delete.cpp")
if(TSAN)
# ThreadSanitizer tries to intercept these symbols. Skip them to avoid
# symbol conflicts.
list(REMOVE_ITEM LIBCXXABI_SOURCES "${LLVM_PROJECT_HOME}/libcxxabi/src/cxa_guard.cpp")
endif()

add_library(libcxxabi ${LIBCXXABI_SOURCES})
target_compile_definitions(
libcxxabi PRIVATE
-D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
)

add_library(libcxx ${LIBCXX_SOURCES})
if(ASAN OR MSAN OR TSAN)
# Sanitizers try to intercept new and delete.
target_compile_definitions(
libcxx PRIVATE
-D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS
)
endif()
target_compile_definitions(
libcxx PRIVATE
-D_LIBCPP_BUILDING_LIBRARY
-DLIBCXX_BUILDING_LIBCXXABI
)
set_target_properties(
libcxx libcxxabi PROPERTIES
COMPILE_FLAGS "-Wno-missing-prototypes -Wno-implicit-fallthrough"
# libc++ and libc++abi must be built in C++20 mode.
CXX_STANDARD 20
CXX_STANDARD_REQUIRED TRUE
)
# libc++abi depends on libc++ internal headers.
set_property(TARGET libcxx libcxxabi APPEND PROPERTY INCLUDE_DIRECTORIES "${LLVM_PROJECT_HOME}/libcxx/src")
target_link_libraries(libcxx libcxxabi)
endif()

if(BUILD_TESTING)
# Add minimal googletest targets. The provided one has many side-effects, and
# googletest has a very straightforward build.
add_library(boringssl_gtest third_party/googletest/src/gtest-all.cc)
if(USE_CUSTOM_LIBCXX)
target_link_libraries(boringssl_gtest libcxx)
endif()
if(BUILD_SHARED_LIBS)
# This is needed for the Windows build to correctly annotate GTest's API with __declspec(dllexport)
target_compile_options(boringssl_gtest PRIVATE -DGTEST_CREATE_SHARED_LIBRARY=1)
Expand Down Expand Up @@ -1116,14 +1034,6 @@ endif()
add_subdirectory(util/fipstools)

if(FUZZ)
if(LIBFUZZER_FROM_DEPS)
file(GLOB LIBFUZZER_SOURCES "util/bot/libFuzzer/*.cpp")
add_library(Fuzzer STATIC ${LIBFUZZER_SOURCES})
# libFuzzer does not pass our aggressive warnings. It also must be built
# without -fsanitize-coverage options or clang crashes.
set_target_properties(Fuzzer PROPERTIES COMPILE_FLAGS "-Wno-shadow -Wno-format-nonliteral -Wno-missing-prototypes -fsanitize-coverage=0")
endif()

add_subdirectory(fuzz)
endif()

Expand Down
11 changes: 0 additions & 11 deletions crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -726,17 +726,6 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "^(Generic|Android)$")
target_link_libraries(crypto PUBLIC Threads::Threads)
endif()

# Every target depends on crypto, so we add libcxx as a dependency here to
# simplify injecting it everywhere.
if(USE_CUSTOM_LIBCXX)
install(TARGETS libcxx libcxxabi
EXPORT crypto-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
target_link_libraries(crypto PUBLIC libcxx)
endif()

if(BUILD_TESTING)
add_subdirectory(test)

Expand Down
7 changes: 1 addition & 6 deletions fuzz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ macro(fuzzer name)
target_compile_options(${name} PRIVATE "-Wno-missing-prototypes")
target_link_libraries(${name} crypto ${ARGN})
target_add_awslc_include_paths(TARGET ${name} SCOPE PRIVATE)
if(LIBFUZZER_FROM_DEPS)
set_target_properties(${name} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer-no-link")
target_link_libraries(${name} Fuzzer)
else()
set_target_properties(${name} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer")
endif()
set_target_properties(${name} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer")
add_dependencies(all_fuzz_tests ${name})
endmacro()

Expand Down
10 changes: 5 additions & 5 deletions tests/ci/run_posix_sanitizers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ unset UBSAN_OPTIONS
if [ $(uname -p) == "aarch64" ]; then
# ARM MSAN runs get stuck on PoolTest.Threads for over an hour https://github.com/aws/aws-lc/issues/13
echo "Building AWS-LC in ${build_type} mode with memory sanitizer."
run_build -DMSAN=1 -DUSE_CUSTOM_LIBCXX=1 "${cflags[@]}"
run_build -DMSAN=1 "${cflags[@]}"
else
echo "Testing AWS-LC in ${build_type} mode with memory sanitizer."
build_and_test -DMSAN=1 -DUSE_CUSTOM_LIBCXX=1 "${cflags[@]}"
build_and_test -DMSAN=1 "${cflags[@]}"
fi

if [ $(uname -p) == "x86_64" ]; then
# x86 TSAN runs get stuck on PoolTest.Threads for over an hour https://github.com/aws/aws-lc/issues/13
echo "Building AWS-LC in ${build_type} mode with thread sanitizer."
run_build -DTSAN=1 -DUSE_CUSTOM_LIBCXX=1 "${cflags[@]}"
run_build -DTSAN=1 "${cflags[@]}"
else
echo "Testing AWS-LC in ${build_type} mode with thread sanitizer."
build_and_test -DTSAN=1 -DUSE_CUSTOM_LIBCXX=1 "${cflags[@]}"
fi
build_and_test -DTSAN=1 "${cflags[@]}"
fi
183 changes: 0 additions & 183 deletions util/bot/DEPS

This file was deleted.

3 changes: 0 additions & 3 deletions util/bot/README

This file was deleted.

Loading
Loading