Fuchsia requires its Scudo shared runtime to not be C++ dependant. Since they
don't use UBSan in conjunction with Scudo, we can just remove the runtime,
and add the extra nostdinc++ and nostdlib++ flags. No need for Coverage
either. This allows to keep things going while working on additional splits
of sanitizer_commong and a more minimal runtime.
Details
Diff Detail
- Repository
- rCRT Compiler Runtime
Event Timeline
I am actually unsure about the FUCHSIA ifs, it is be used on the builtins but I can't see it defined in compiler-rt.
Finally have a working Fuchsia toolchain, so I don't have to ask @flowerhack to test my stuff all the time.
I am going to make sure this works as intended and comment back here.
Finally got the toolchain working.
A few changes: -nostdlib++ is a clang flag, and as of now Fuchsia requires
libunwind to be explicitely linked (it was in SANITIZER_CXX_ABI_LIBRARY
before). It will go away when I am done splitting the stacktraces from
RTSanitizerCommon.
Resulting binary for Fuchsia is no longer C++ dependent (UBSan is gone - for
now), but still has ~512kB of unneeded BSS usage due to the internal allocator
used by the symbolizer. This will also go away when the split it done.
lib/scudo/CMakeLists.txt | ||
---|---|---|
24 | You could add RTSanitizerCommonCoverage, RTUbsan, RTUbsan_cxx to a variable (e.g. ${SCUDO_EXTRA_OBJECT_LIBS}) and ${SANITIZER_CXX_ABI_LIBRARY} to ${SCUDO_DYNAMIC_LIBS} in the else branch and then you don't need the two different branches for add_compiler_rt_runtime(clang_rt.scudo ...) below. | |
63–64 | Is this needed? I see it being included in STATIC library for all platforms and SHARED library for everything but Fuchsia. Is that correct? |
lib/scudo/CMakeLists.txt | ||
---|---|---|
24 | Will do. | |
63–64 | That is correct. |
lib/scudo/CMakeLists.txt | ||
---|---|---|
26 | I think -nostdlib++ should be in SCUDO_DYNAMIC_LINK_FLAGS as -Wl,-nostdlib++ (unless add_compiler_rt_runtime already adds all CFLAGS to LDFLAGS automatically). |
lib/scudo/CMakeLists.txt | ||
---|---|---|
26 | I tried that initially but lld (unlike ld) doesn't seem to support it: |
You could add RTSanitizerCommonCoverage, RTUbsan, RTUbsan_cxx to a variable (e.g. ${SCUDO_EXTRA_OBJECT_LIBS}) and ${SANITIZER_CXX_ABI_LIBRARY} to ${SCUDO_DYNAMIC_LIBS} in the else branch and then you don't need the two different branches for add_compiler_rt_runtime(clang_rt.scudo ...) below.