forked from OSchip/llvm-project
[clang][Fuchsia] Add relative-vtables + asan multilibs
We're choosing to take an opt-in approach for landing Relative VTables, so we'll need asan-equivalent multilibs with relative vtables enabled. Afterwards, we can just flip the switch in our build. Differential Revision: https://reviews.llvm.org/D95253
This commit is contained in:
parent
080952a944
commit
c0e94e9974
|
@ -214,21 +214,37 @@ if(FUCHSIA_SDK)
|
|||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables_CMAKE_CXX_FLAGS "${RUNTIMES_${target}-unknown-fuchsia+relative-vtables_CMAKE_CXX_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
|
||||
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan_LLVM_USE_SANITIZER "Address" CACHE STRING "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan_CMAKE_CXX_FLAGS "${RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan_CMAKE_CXX_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
|
||||
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+noexcept_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+noexcept_CMAKE_CXX_FLAGS "${RUNTIMES_${target}-unknown-fuchsia+relative-vtables+noexcept_CMAKE_CXX_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan+noexcept_LLVM_BUILD_COMPILER_RT OFF CACHE BOOL "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan+noexcept_LLVM_USE_SANITIZER "Address" CACHE STRING "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan+noexcept_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan+noexcept_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan+noexcept_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan+noexcept_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
|
||||
set(RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS "${RUNTIMES_${target}-unknown-fuchsia+relative-vtables+asan+noexcept_CMAKE_CXX_FLAGS} -Xclang -fexperimental-relative-c++-abi-vtables" CACHE STRING "")
|
||||
|
||||
# Use .build-id link.
|
||||
list(APPEND RUNTIME_BUILD_ID_LINK "${target}-unknown-fuchsia")
|
||||
endforeach()
|
||||
|
||||
set(LLVM_RUNTIME_MULTILIBS "asan;noexcept;asan+noexcept;relative-vtables;relative-vtables+noexcept" CACHE STRING "")
|
||||
set(LLVM_RUNTIME_MULTILIBS "asan;noexcept;asan+noexcept;relative-vtables;relative-vtables+noexcept;relative-vtables+asan;relative-vtables+asan+noexcept" CACHE STRING "")
|
||||
set(LLVM_RUNTIME_MULTILIB_asan_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
|
||||
set(LLVM_RUNTIME_MULTILIB_noexcept_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
|
||||
set(LLVM_RUNTIME_MULTILIB_asan+noexcept_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
|
||||
set(LLVM_RUNTIME_MULTILIB_relative-vtables_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
|
||||
set(LLVM_RUNTIME_MULTILIB_relative-vtables+noexcept_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
|
||||
set(LLVM_RUNTIME_MULTILIB_relative-vtables+asan_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
|
||||
set(LLVM_RUNTIME_MULTILIB_relative-vtables+asan+noexcept_TARGETS "x86_64-unknown-fuchsia;aarch64-unknown-fuchsia" CACHE STRING "")
|
||||
endif()
|
||||
|
||||
set(LLVM_BUILTIN_TARGETS "${BUILTIN_TARGETS}" CACHE STRING "")
|
||||
|
|
|
@ -211,12 +211,22 @@ Fuchsia::Fuchsia(const Driver &D, const llvm::Triple &Triple,
|
|||
.flag("-fexceptions")
|
||||
.flag("+fno-exceptions"));
|
||||
// Use the relative vtables ABI.
|
||||
// TODO: Remove these multilibs once relative vtables are enabled by default
|
||||
// for Fuchsia.
|
||||
Multilibs.push_back(Multilib("relative-vtables", {}, {}, 4)
|
||||
.flag("+fexperimental-relative-c++-abi-vtables"));
|
||||
Multilibs.push_back(Multilib("relative-vtables+noexcept", {}, {}, 5)
|
||||
.flag("+fexperimental-relative-c++-abi-vtables")
|
||||
.flag("-fexceptions")
|
||||
.flag("+fno-exceptions"));
|
||||
Multilibs.push_back(Multilib("relative-vtables+asan", {}, {}, 6)
|
||||
.flag("+fexperimental-relative-c++-abi-vtables")
|
||||
.flag("+fsanitize=address"));
|
||||
Multilibs.push_back(Multilib("relative-vtables+asan+noexcept", {}, {}, 7)
|
||||
.flag("+fexperimental-relative-c++-abi-vtables")
|
||||
.flag("+fsanitize=address")
|
||||
.flag("-fexceptions")
|
||||
.flag("+fno-exceptions"));
|
||||
Multilibs.FilterOut([&](const Multilib &M) {
|
||||
std::vector<std::string> RD = FilePaths(M);
|
||||
return std::all_of(RD.begin(), RD.end(), [&](std::string P) {
|
||||
|
|
|
@ -96,10 +96,37 @@
|
|||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
|
||||
// RUN: -fuse-ld=lld 2>&1\
|
||||
// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-NOEXCEPT-X86
|
||||
// RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables -fsanitize=address \
|
||||
// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
|
||||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
|
||||
// RUN: -fuse-ld=lld 2>&1\
|
||||
// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-X86
|
||||
// RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables -fno-exceptions -fsanitize=address \
|
||||
// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
|
||||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
|
||||
// RUN: -fuse-ld=lld 2>&1\
|
||||
// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-NOEXCEPT-X86
|
||||
// RUN: %clangxx %s -### --target=x86_64-fuchsia -fno-experimental-relative-c++-abi-vtables \
|
||||
// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
|
||||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
|
||||
// RUN: -fuse-ld=lld 2>&1\
|
||||
// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
|
||||
// RUN: %clangxx %s -### --target=x86_64-fuchsia -fno-experimental-relative-c++-abi-vtables \
|
||||
// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
|
||||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
|
||||
// RUN: -fuse-ld=lld 2>&1\
|
||||
// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
|
||||
// RUN: %clangxx %s -### --target=x86_64-fuchsia -fno-experimental-relative-c++-abi-vtables -fexperimental-relative-c++-abi-vtables \
|
||||
// RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
|
||||
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
|
||||
// RUN: -fuse-ld=lld 2>&1\
|
||||
// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
|
||||
// CHECK-MULTILIB-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
|
||||
// CHECK-MULTILIB-ASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}asan"
|
||||
// CHECK-MULTILIB-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}noexcept"
|
||||
// CHECK-MULTILIB-ASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}asan+noexcept"
|
||||
// CHECK-MULTILIB-RELATIVE-VTABLES-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}relative-vtables"
|
||||
// CHECK-MULTILIB-RELATIVE-VTABLES-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}relative-vtables+noexcept"
|
||||
// CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}relative-vtables+asan"
|
||||
// CHECK-MULTILIB-RELATIVE-VTABLES-ASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}relative-vtables+asan+noexcept"
|
||||
// CHECK-MULTILIB-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++"
|
||||
|
|
Loading…
Reference in New Issue