[cfe-dev] recent change broke -fcatch-undefined-behavior

David Blaikie dblaikie at gmail.com
Mon Oct 15 12:21:17 PDT 2012


On Mon, Oct 15, 2012 at 12:17 PM, Sean McBride <sean at rogue-research.com> wrote:
> On Mon, 15 Oct 2012 20:39:21 +0200, Jean-Daniel Dupas said:
>
>>> I see that there have been recent changes wrt -fcatch-undefined-
>>behavior, and within the last week or so something changed such that my
>>own build of clang (built with CMake on OS X) is unable to build simple
>>programs that use -fcatch-undefined-behavior, I get link errors like:
>>>
>>>  "___ubsan_handle_divrem_overflow", referenced from:
>>>      _main in test-OSZvjm.o
>>>  "___ubsan_handle_type_mismatch", referenced from:
>>>      _main in test-OSZvjm.o
>>>
>>> Any ideas why?
>>>
>>
>>This is a new feature. Instead of generating traps, -fcatch-undefined-
>>behavior generates library calls that make it easier to find what is
>>wrong (each undefined behavior calls a different function).
>>
>>This functions are provided by the ubsan library that is part of
>>compiler-rt. But I'm not sure the integration to the Makefile build
>>system is done yet.
>
> You mean with the CMake build system?

Generally "Makefile build system" describes the configure+make build
system (at least when it's discussed here).

> Perhaps if I build using autotools it will work?  Or do you mean it works nowhere yet?

I believe the implication is that it works with the CMake build
system. But you will need to checkout the compiler-rt LLVM project
into llvm/projects to build it along with clang. (& I assume you'll
need to install compiler-rt alongside clang as well, but hopefully the
install target does that)

- David



More information about the cfe-dev mailing list