[PATCH] D31140: [LLVMbugs] [Bug 18710] Only generate .ARM.exidx and .ARM.extab when needed in EHABI

Christian Bruel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 21 12:53:05 PDT 2017


chrib added a comment.

In https://reviews.llvm.org/D31140#706411, @jroelofs wrote:

> Can you clarify the logic here? It's my understanding that:
>
> `-fno-exceptions` does *not* imply `-fno-unwind-tables`
>
> however:
>
> `-fno-unwind-tables` *does* imply that exceptions cannot be used on targets that require the tables to do unwinding.


Yes, (bad things might happen or (std::terminate will be called, or destructors not called.)...

But -f[no]-unwind-tables implies the UWTable attribute, not NoUwind attribute. To toggle NoUnwind, use -fno-exceptions

And this is getting worse with .canunwind which means DoesNotThrow :)

in my understanding,  the logic is as follow:

Since "An exception cannot propagate through a function with a nounwind table. The exception handling runtime environment terminates the program if it encounters a nounwind table during exception processing." (ARM Information Center)

The "nounwind" LLVM attribute, which means "Function does not throw" translates as the EXIDX_CANTUNWIND value in the exception table index table which needs to be created for the purpose (for the function)

And of course without exception runtime environment (the test here) we don't need this table. So I can see 3 cases:

- nounwind set :                    Generate .cantunwind directive and unwind table
- nounwind set but not EH   Do not generate the .cantunwind directive and do not emit the unwind table
- uwtable set                         Need to generate the unwind table (even without EH)

The  disable-arm-cantunwind flag means: without EH support if the function does not throw, do dot generate the exception tables and the EXIDX_CANTUNWIND value.


https://reviews.llvm.org/D31140





More information about the cfe-commits mailing list