Scudo uses C++ but doesn't use C++ library. Set -nostdinc++ and
-nostdlib++ flags to enforce this and avoid accidental references.
Details
- Reviewers
cryptoad
Diff Detail
Event Timeline
So as is this gets me clang-6.0: error: argument unused during compilation: '-nostdlib++' [-Werror,-Wunused-command-line-argument].
I duplicated SCUDO_CFLAGS to SCUDO_CXXFLAGS and added -nostdlib++ there, replacing the flags for the CXX static library & the .so and this works, but I am not sure it achieves what you want.
Nevermind, I messed up the variable name it doesn't work either, -Wl, is what we want.
So it looks like it's going to be a bit more complicated.
There is C++ dependencies in UBSan (dynamic_cast and whatnot) and we pull in RTUBsan.
The base link flags are SANITIZER_COMMON_LINK_LIBS, SANITIZER_CXX_ABI_LIBRARY, which will pull in a C++ library.
As far as I understand, you guys don't care about a -fsanitize=scudo,undefine yet, so the way to go is a UBsan free Scudo (scudo-minimal or something).
Unless I'm misunderstanding the point.
The missing -Wl, is a mistake on my side. This came up while cleaning up the libc++ installation process which made the Scudo build to fail because Scudo couldn't find libc++ headers which was expected since Scudo doesn't have an explicit dependency on it. So either it needs to have that dependency (at least on Fuchsia where libc++ is being built as part of LLVM and doesn't come from sysroot) or it should disable it altogether which is what this patch does. Having scudo-minimal sounds like something we probably want although it wasn't the original motivation behind this patch.
On Linux with -Wl,-nostdlib++, this doesn't compile as is with some complains about -lgcc_s not being found (from memory, not in front of my desktop now).
I figured the minimal build would be solution, I can dig into this tomorrow.
With the patch as is, it fails with gcc/clang on Linux with: /usr/bin/ld: cannot find -lgcc_s
Should those new options be Fuchsia only?