Page MenuHomePhabricator

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

Authored by morehouse on Apr 23 2019, 7:04 PM.

Details

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.

Diff Detail

Event Timeline

morehouse created this revision.Apr 23 2019, 7:04 PM
Herald added a project: Restricted Project. · View Herald Transcript
kcc added a subscriber: kcc.Apr 23 2019, 10:16 PM

a test maybe?

LGTM

Related to this does anything in libFuzzer uses RTTI? If not we could also consider disabling RTTI to save extra space.

phosek accepted this revision.Apr 24 2019, 9:31 AM
This revision is now accepted and ready to land.Apr 24 2019, 9:31 AM
  • Add test.

Related to this does anything in libFuzzer uses RTTI? If not we could also consider disabling RTTI to save extra space.

I'll look into this and mail a followup patch if possible.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2019, 11:14 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript

Related to this does anything in libFuzzer uses RTTI? If not we could also consider disabling RTTI to save extra space.

I'll look into this and mail a followup patch if possible.

It doesn't look like we need RTTI, but I tried building libc++ without it and started getting link errors:

llvm-build/projects/compiler-rt/lib/fuzzer/tests/libRTFuzzerTest.x86_64.a(FuzzerDriver.cpp.o):(.data.rel.ro._ZTINSt6Fuzzer18basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE[_ZTINSt6Fuzzer18basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE]+0x10): undefined reference to `typeinfo for std::Fuzzer::basic_iostream<char, std::Fuzzer::char_traits<char> >'

llvm-build/projects/compiler-rt/lib/fuzzer/tests/libRTFuzzerTest.x86_64.a(FuzzerDriver.cpp.o):(.data.rel.ro._ZTINSt6Fuzzer15basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEEE[_ZTINSt6Fuzzer15basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEEE]+0x10): undefined reference to `typeinfo for std::Fuzzer::basic_streambuf<char, std::Fuzzer::char_traits<char> >'

llvm-build/projects/compiler-rt/lib/fuzzer/tests/libRTFuzzerTest.x86_64.a(FuzzerFork.cpp.o):(.data.rel.ro._ZTCNSt6Fuzzer19basic_istringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_13basic_istreamIcS2_EE[_ZTCNSt6Fuzzer19basic_istringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_13basic_istreamIcS2_EE]+0x10): undefined reference to `typeinfo for std::Fuzzer::basic_istream<char, std::Fuzzer::char_traits<char> >'