[PATCH] Propagate -fno-unwind-tables to EHABI

Renato Golin renato.golin at linaro.org
Mon Mar 17 11:26:54 PDT 2014



================
Comment at: test/CodeGen/ARM/ehabi.ll:283
@@ -282,3 +282,3 @@
 
-define void @test4() nounwind {
+define void @test4() uwtable nounwind {
 entry:
----------------
Logan Chien wrote:
> Renato Golin wrote:
> > Logan Chien wrote:
> > > Is this change of test case correct?  IIRC, .cantunwind shouldn't be emitted when the function has uwtable attribute.
> > > 
> > > I remembered that Rafael had argued for this **feature** in the mailing list.
> > You need to have unwind tables to emit .cantunwind, so I'm not sure what do you mean. Since this function is a leaf function (and it doesn't throw), it cannot possible unwind, but it still needs the tables. It's still possible to unwind it in debug/profiling modes, though.
> > 
> > Right now, all functions in x86_64 and ARM will have uwtable (unless -fno-unwind-tables), and all non-throwing functions will have nounwind, so that can't be a feature, at least not right now.
> Although, the meaning of `uwtable` is not precisely defined in the language spec, based on the existing code, I believe `uwtable` means the ability to unwind to previous frame.  The function with `uwtable` attribute should encoding the stack information properly so that the stack unwinder can pass through the frame without problems.  However, the cantunwind directive simply stops the stack unwinder.
> 
> You can compare the code with and without this change and you will know what I mean.
> 
> I guess changing ARMException.cpp line 89 to:
> 
>     if (!shouldEmitEH)
> 
> And remove line 85, can keep this test case unchanged.
Exception handling unwinding is not the same as debug+profiling unwinding. It's perfectly possible to unwind the stack even if the current frame has .cantunwind. On ARM, remember, we have the CFI directives for the debug info, so the changes are exclusively for EH and completely orthogonal to Debug+profile.

Also, I can't change the code to:

  if (!shouldEmitEH)

Since it'd emit .cantunwind without .fnstart/.fnend, which would break the table.


http://llvm-reviews.chandlerc.com/D3079



More information about the llvm-commits mailing list