[compiler-rt] r228384 - [UBSan] Enable -Wglobal-constructors.
Justin Bogner
mail at justinbogner.com
Tue Feb 10 18:10:06 PST 2015
Yury Gribov <y.gribov at samsung.com> writes:
> Author: ygribov
> Date: Thu Feb 5 23:53:08 2015
> New Revision: 228384
>
> URL: http://llvm.org/viewvc/llvm-project?rev=228384&view=rev
> Log:
> [UBSan] Enable -Wglobal-constructors.
I don't think we can do this, since we use global constructors. This has
been warning on darwin since it was committed:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_build/1476/warnings7Result/
Looks like it won't warn on linux, but it does on darwin and probably
android. From ubsan_init.cc:
#if SANITIZER_CAN_USE_PREINIT_ARRAY
__attribute__((section(".preinit_array"), used))
void (*__local_ubsan_preinit)(void) = __ubsan::InitIfNecessary;
#else
// Use a dynamic initializer.
class UbsanInitializer {
public:
UbsanInitializer() {
InitIfNecessary();
}
};
static UbsanInitializer ubsan_initializer;
#endif // SANITIZER_CAN_USE_PREINIT_ARRAY
> Modified:
> compiler-rt/trunk/lib/ubsan/CMakeLists.txt
>
> Modified: compiler-rt/trunk/lib/ubsan/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/CMakeLists.txt?rev=228384&r1=228383&r2=228384&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/ubsan/CMakeLists.txt (original)
> +++ compiler-rt/trunk/lib/ubsan/CMakeLists.txt Thu Feb 5 23:53:08 2015
> @@ -17,7 +17,12 @@ include_directories(..)
>
> set(UBSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
> append_no_rtti_flag(UBSAN_CFLAGS)
> +append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors
> + UBSAN_CFLAGS)
> +
> set(UBSAN_CXXFLAGS ${SANITIZER_COMMON_CFLAGS})
> +append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors
> + UBSAN_CXXFLAGS)
>
> add_custom_target(ubsan)
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list