[cfe-dev] -fsanitize=undefined and shared libraries

Martin Martin martin at silverliningsystems.com
Thu Jan 17 12:05:33 PST 2013


Hey Will,

I'm using vanilla clang/compiler-rt, not the "always link in ubsan"
workaround.

It now compiles and runs my unit tests!  However, using std::fixed like
this:

#include <iostream>

int main()
{
    std::cout << std::fixed;
    return 0;
}

Gives this error message:

$ clang++ -g -fsanitize=undefined foo.cpp && ./a.out

==15067== WARNING: Trying to symbolize code, but external symbolizer is not
initialized!

/home/martin/cache/lib/a.out:0x402918: runtime error: load of value
4294967035, which is not a valid value for type 'std::_Ios_Fmtflags'
/home/martin/cache/lib/a.out:0x402b44: runtime error: load of value
4294967035, which is not a valid value for type 'std::_Ios_Fmtflags'

Two questions:

Should I ignore the warning, if not, how do I fix it?

Is there a way to suppress messages from the standard library?  I'm
guessing not, but I can write a quick script on my end to filter them out.

Best,
Martin


On Thu, Jan 17, 2013 at 12:19 PM, Will Dietz <willdtz at gmail.com> wrote:

> Bah, missed one! :).  Thanks Alexey, fixed in r172730.
>
> Martin, can you update and try now?  Let me know if you have any
> further linking issues.
>
> As an aside, are you using vanilla clang/compiler-rt, or did you need
> to apply the "always link in ubsan" workaround discussed in this
> thread?
>
> Thanks, happy code checking! :)
>
> ~Will
>
> On Thu, Jan 17, 2013 at 9:21 AM, Alexey Samsonov <samsonov at google.com>
> wrote:
> >
> > On Thu, Jan 17, 2013 at 7:02 PM, Martin Martin
> > <martin at silverliningsystems.com> wrote:
> >>
> >> Any word on this linking error?  Would a test case help?
> >>
> >> Thanks,
> >> Martin
> >>
> >>
> >>
> >> On Sat, Jan 12, 2013 at 4:40 PM, Martin Martin
> >> <martin at silverliningsystems.com> wrote:
> >>>
> >>> Great, that works!  The next linking error I get is:
> >>>
> >>>  hidden symbol `__ubsan_vptr_type_cache' in
> >>>
> /home/martin/clang/build/bin/../lib/clang/3.3/lib/linux/libclang_rt.ubsan-x86_64.a(ubsan_type_hash.cc.o)
> >>> is referenced by DSO
> >
> >
> > Just a random guess - would adding SANITIZER_INTERFACE_ATTRIBUTE to
> > __ubsan_vptr_type_cache definition help? Like this:
> > extern "C" SANITIZER_INTERFACE_ATTRIBUTE HashValue
> > __ubsan_vptr_type_cache[VptrTypeCacheSize];
> >
> >
> >>>
> >>>
> >>> It's a little trouble for me to narrow down the test case, but I'm
> happy
> >>> to do it if it helps.
> >>>
> >>> Thanks,
> >>> Martin
> >>>
> >>
> >> _______________________________________________
> >> cfe-dev mailing list
> >> cfe-dev at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >>
> >
> >
> >
> > --
> > Alexey Samsonov, MSK
> >
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130117/45fc658b/attachment.html>


More information about the cfe-dev mailing list