[compiler-rt] r359218 - [compiler-rt] Build custom libc++abi without exceptions.

Matt Morehouse via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 11:14:25 PDT 2019


Author: morehouse
Date: Thu Apr 25 11:14:24 2019
New Revision: 359218

URL: http://llvm.org/viewvc/llvm-project?rev=359218&view=rev
Log:
[compiler-rt] Build custom libc++abi without exceptions.

Summary:
Since neither compiler-rt nor the libc++ we build use exceptions, we
don't need libc++abi to have them either.

This resolves an issue where libFuzzer's private libc++ contains
implementations for __cxa_throw and friends, causing fuzz targets built
with their own C++ library to segfault during exception unwinding.

See https://github.com/google/oss-fuzz/issues/2328.

Reviewers: phosek, EricWF, kcc

Reviewed By: phosek

Subscribers: kcc, dberris, mgorny, christof, llvm-commits, metzman

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D61053

Added:
    compiler-rt/trunk/test/fuzzer/libcxx.test
Modified:
    compiler-rt/trunk/cmake/Modules/CustomLibcxx/CMakeLists.txt

Modified: compiler-rt/trunk/cmake/Modules/CustomLibcxx/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CustomLibcxx/CMakeLists.txt?rev=359218&r1=359217&r2=359218&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CustomLibcxx/CMakeLists.txt (original)
+++ compiler-rt/trunk/cmake/Modules/CustomLibcxx/CMakeLists.txt Thu Apr 25 11:14:24 2019
@@ -4,6 +4,7 @@ project(custom-libcxx C CXX)
 # Build static libcxxabi.
 set(LIBCXXABI_STANDALONE_BUILD 1)
 set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
 set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE STRING "")
 set(LIBCXXABI_LIBCXX_PATH ${COMPILER_RT_LIBCXX_PATH} CACHE PATH "")
 set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "")

Added: compiler-rt/trunk/test/fuzzer/libcxx.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/libcxx.test?rev=359218&view=auto
==============================================================================
--- compiler-rt/trunk/test/fuzzer/libcxx.test (added)
+++ compiler-rt/trunk/test/fuzzer/libcxx.test Thu Apr 25 11:14:24 2019
@@ -0,0 +1,15 @@
+# Ensures that the libFuzzer library does not export exceptions.
+
+RUN: %cpp_compiler %S/SimpleTest.cpp -o %t
+RUN: nm %t 2>&1 | FileCheck %s
+
+CHECK-NOT: t __cxa_allocate_dependent_exception
+CHECK-NOT: t __cxa_allocate_exception
+CHECK-NOT: t __cxa_begin_catch
+CHECK-NOT: t __cxa_call_unexpected
+CHECK-NOT: t __cxa_current_exception_type
+CHECK-NOT: t __cxa_end_catch
+CHECK-NOT: t __cxa_free_dependent_exception
+CHECK-NOT: t __cxa_free_exception
+CHECK-NOT: t __cxa_get_exception_ptr
+CHECK-NOT: t __cxa_throw




More information about the llvm-commits mailing list