[compiler-rt] r228384 - [UBSan] Enable -Wglobal-constructors.

Alexey Samsonov vonosmas at gmail.com
Tue Feb 10 18:27:44 PST 2015


Ah, right...
Feel free to revert this change. I have plans to deal with different UBSan
initialization issues soon, and will see if I would be able to
reinstantiate this warning on all platforms.

On Tue, Feb 10, 2015 at 6:10 PM, Justin Bogner <mail at justinbogner.com>
wrote:

> 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
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



-- 
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150210/3e77f0d7/attachment.html>


More information about the llvm-commits mailing list