[LLVMdev] LLVM_REQUIRES_EH
Gordon Keiser
gkeiser at arxan.com
Fri Aug 15 13:11:32 PDT 2014
> On 15 August 2014 02:48, Chandler Carruth <chandlerc at google.com> wrote:
>>
>> On Thu, Aug 14, 2014 at 6:01 PM, Reid Kleckner <rnk at google.com> wrote:
>>>
>>> I thought Linux distros compile LLVM with RTTI and exceptions enabled
>>> when packaging.
>>
>>
>> The question is why.
>>
>> RTTI makes sense -- they may well need it.
>>
>> But exceptions should work fine in the rest of the application even if
>> LLVM is compiled with them, no?
>
> I assume you meant to say "even if LLVM is compiled without them".
>
> If so I was under the impression that if LLVM code built **without** EH calls into the client code built **with** EH and that client code then throws an exception that this exception would not be properly propaged through the call stack. I've never tested this myself but my reasoning came from [1] and in particular the following from [2]
>
[snip]
I can verify that this is a problem, and one that causes a crash.
We use the REQUIRES_EH flag along with some CMakeLists changes to make sure that EH is turned on for all builds (but could switch to the other flag). In most cases, mixed compiling shouldn't be a problem, but if something like a user-written ModulePass throws an exception, the program will break in interesting and magical ways since the stack isn't unwound correctly. For us, not using exceptions is out of the question, so we need to turn them on for LLVM.
That said, I don't have a particular preference on what flag is used, and it sounds like there is an alternative to REQUIRES_EH now, so I don't see a problem removing the old one (If I remember correctly it was messed up on Windows anyway).
Cheers,
Gordon Keiser
Software Development Engineer
Arxan Technologies
More information about the llvm-dev
mailing list