Pablo Barrio
2011-May-16 14:44 UTC
[LLVMdev] Exception handling with the LLVM makefile system
Hi all, I'm having trouble when trying to reuse some functions that use Boost::Exception into my LLVM-based application. As far as I know, LLVM turns off Exception handling (apparently for performance reasons), so I get the following link-time error in a few places: "undefined reference to `boost::throw_exception(std::exception const&)" When I compile the external code from outside the LLVM Makefile system, everything goes well. Is it possible to enable exception handling for some parts of the compilation? Just like turning on RTTI with "REQUIRES_RTTI=1" ? Removing exception handling from the functions is not an option, since I would have to tweak the Boost library internals. Thanks ahead! -- Pablo Barrio Dpto. Ing. Electrónica - E.T.S.I. Telecomunicación Despacho C-203 Avda. Complutense s/n, 28040 Madrid Tlf. 915495700 ext. 4234 @: pbarrio at die.upm.es
Sebastian Redl
2011-May-16 15:11 UTC
[LLVMdev] Exception handling with the LLVM makefile system
On 16.05.2011, at 08:44, Pablo Barrio wrote:> Hi all, > > I'm having trouble when trying to reuse some functions that use > Boost::Exception into my LLVM-based application. As far as I know, LLVM > turns off Exception handling (apparently for performance reasons), so I > get the following link-time error in a few places: > > "undefined reference to `boost::throw_exception(std::exception const&)" > > When I compile the external code from outside the LLVM Makefile system, > everything goes well. Is it possible to enable exception handling for > some parts of the compilation? Just like turning on RTTI with > "REQUIRES_RTTI=1" ? Removing exception handling from the functions is > not an option, since I would have to tweak the Boost library internals.Whatever the LLVM side of things, boost::throw_exception is a function that you, the user, have to implement when disabling exceptions. It's basically the "I want to throw an exception, so what should I really do?" callback. Sebastian
Pablo Barrio
2011-May-16 16:32 UTC
[LLVMdev] Exception handling with the LLVM makefile system
On 05/16/2011 05:11 PM, Sebastian Redl wrote:> On 16.05.2011, at 08:44, Pablo Barrio wrote: > >> Hi all, >> >> I'm having trouble when trying to reuse some functions that use >> Boost::Exception into my LLVM-based application. As far as I know, LLVM >> turns off Exception handling (apparently for performance reasons), so I >> get the following link-time error in a few places: >> >> "undefined reference to `boost::throw_exception(std::exception const&)" >> >> When I compile the external code from outside the LLVM Makefile system, >> everything goes well. Is it possible to enable exception handling for >> some parts of the compilation? Just like turning on RTTI with >> "REQUIRES_RTTI=1" ? Removing exception handling from the functions is >> not an option, since I would have to tweak the Boost library internals. > Whatever the LLVM side of things, boost::throw_exception is a function that you, the user, have to implement when disabling exceptions. It's basically the "I want to throw an exception, so what should I really do?" callback. > > SebastianThat's right, I wrote a throw_exception() function with the sole purpose of avoiding error messages. However, I'm not really an expert on exception handling: the function just prints out an error message. boost::throw_exception allows handling exceptions just as when using the C++ builtin "throw" features. The selection of either method is done by defining BOOST_NO_EXCEPTIONS. I'd like to use the standard exceptions instead of making my own. Do you think that's possible? Is it possible (and correct) to turn on exception handling with LLVM? -- Pablo Barrio Dpto. Ing. Electrónica - E.T.S.I. Telecomunicación Despacho C-203 Avda. Complutense s/n, 28040 Madrid Tlf. 915495700 ext. 4234 @: pbarrio at die.upm.es