[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
Fri Sep 8 05:13:42 PDT 2017


chrib planned changes to this revision.
chrib added a comment.

Yes, I also tried to look into this direction, but I did not found a clean way from the driver to emit the attribute based on codegen options. Also unwind-tables must not be the default. (for C this is what I want to eliminate). In fact I haven't found an example of setting attributes in the driver. not sure it's even possible.

Also, setting this new uwtable attribute close to the existing NoUnwind attribute in CodeGen makes the orthogonality both attributes more obvious (or less obscure :-).

This said, testing for the Triple Arch here is not clean (I probably prefer a target overloads) but that was a conservative approach. to avoid that we would need to propose a follow up that simplifies the code as:

  // We might need an unwind table, even if the function cannot throw.                                                                                                                                                                                                                                                         
  if (hasUnwindExceptions(LangOpts) || CodeGenOpts.UnwindTables)
    B.addAttribute(llvm::Attribute::UWTable);
  
  // If the module doesn't support exceptions the function cannot throw.                                                                                                                                                                                                                                                       
  // We can have a nothrow function even if unwind tables are required.                                                                                                                                                                                                                                                        
  if (!hasUnwindExceptions(LangOpts))
    B.addAttribute(llvm::Attribute::NoUnwind);

but this will impact all targets and can cause other changes in the backend, so it's probably better to do this separately. Do you have an advice on that ?

thanks,


https://reviews.llvm.org/D31140





More information about the cfe-commits mailing list