<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 11, 2015 at 12:37 AM, Yury Gribov <span dir="ltr"><<a href="mailto:y.gribov@samsung.com" target="_blank">y.gribov@samsung.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 02/11/2015 09:04 AM, Yury Gribov wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 02/11/2015 06:07 AM, Justin Bogner wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Alexey Samsonov <<a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a>> writes:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Ah, right...<br>
Feel free to revert this change. I have plans to deal with different<br>
UBSan<br>
initialization issues soon, and will see if I would be able to<br>
reinstantiate<br>
this warning on all platforms.<br>
</blockquote>
<br>
Reverted in r228795.<br>
</blockquote>
<br>
Can't we just move initializer to separate file for which we then<br>
disable this warning?<br>
</blockquote>
<br></div></div>
Does something like this make sense? It passes tests on Linux x64. I haven't verified OSX but I can see that -Wglobal-constructors is indeed disabled for ubsan_init.cc.</blockquote><div><br></div><div>In fact, I wanted to split UBSan runtime into three parts: UBSan (UBSAN_SOURCES without ubsan_init.cc), UBSanCXX (UBSAN_CXX_SOURCES) and UBSanStandalone (~ubsan_init.cc).</div><div>Standalone UBSan would contain all three of them, while the first two would also be embedded into ASan runtime. After we do this separation, it would be easy</div><div>to specify -Wglobal-constructors just for UBSan and UBSanCXX.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
-Y<br>
<br>
</font></span><br>commit 991071e4b2c7a8d3fa247927adc5f3f256a91580<br>
Author: Yury Gribov <<a href="mailto:y.gribov@samsung.com">y.gribov@samsung.com</a>><br>
Date:   Wed Feb 4 16:30:22 2015 +0300<br>
<br>
    [UBSan] Re-enable -Wglobal-constructors portably.<br>
<br>
diff --git a/lib/ubsan/CMakeLists.txt b/lib/ubsan/CMakeLists.txt<br>
index 09c7a85..e321eb8 100644<br>
--- a/lib/ubsan/CMakeLists.txt<br>
+++ b/lib/ubsan/CMakeLists.txt<br>
@@ -19,6 +19,12 @@ set(UBSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})<br>
 append_no_rtti_flag(UBSAN_CFLAGS)<br>
 set(UBSAN_CXXFLAGS ${SANITIZER_COMMON_CFLAGS})<br>
<br>
+if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG)<br>
+  list(APPEND UBSAN_CFLAGS -Wglobal-constructors)<br>
+  list(APPEND UBSAN_CXXFLAGS -Wglobal-constructors)<br>
+  set_source_files_properties(ubsan_init.cc PROPERTIES COMPILE_FLAGS -Wno-global-constructors)<br>
+endif()<br>
+<br>
 add_custom_target(ubsan)<br>
<br>
 if(APPLE)<br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div></div>