This is an archive of the discontinued LLVM Phabricator instance.

[LLVMbugs] [Bug 18710] Only generate .ARM.exidx and .ARM.extab when needed with EHABI
Needs ReviewPublic

Authored by chrib on Mar 20 2017, 10:38 AM.

Details

Summary

This patch sets the UWTable attribute to generate the unwind table when needed only. Consequently don't emit the.exidx and .extab sections if the language doesn't require them.

Set in Clang only when exceptions are supported (https://reviews.llvm.org/D31140)

This makes the -fno-unwind-tables and -fno-exceptions options effective, matching GCC behavior. This is also a code size optimization since those sections map in the loadable text segment.

Diff Detail

Event Timeline

chrib created this revision.Mar 20 2017, 10:38 AM
chrib retitled this revision from [LLVMbugs] [Bug 18710] Only generate .ARM.exidx and .ARM.extab when needed in EHABI to [LLVMbugs] [Bug 18710] Only generate .ARM.exidx and .ARM.extab when needed with EHABI.Mar 21 2017, 1:35 AM
chrib edited the summary of this revision. (Show Details)
chrib updated this revision to Diff 93628.Mar 31 2017, 6:12 AM
  1. Updating D31139: [LLVMbugs] [Bug 18710] Only generate .ARM.exidx and .ARM.extab when needed with EHABI #

Emit cantunwind directive if uwtable is set and the function cannot throw
Emit unwind table if uwtable is set

The tests that check for the existence of .fnstart directives should have the uwtable attribute set

chrib updated this revision to Diff 93638.Mar 31 2017, 6:50 AM
  1. Updating D31139: [LLVMbugs] [Bug 18710] Only generate .ARM.exidx and .ARM.extab when needed with EHABI #

Fix thinkos/typos.

chrib edited the summary of this revision. (Show Details)Mar 31 2017, 6:55 AM
chrib edited the summary of this revision. (Show Details)Apr 6 2017, 2:17 AM
chrib updated this revision to Diff 113848.Sep 5 2017, 6:25 AM
chrib edited the summary of this revision. (Show Details)

Rebase and do not emit unwinder directives if not needed. Update tests accordingly.

I'm sort of concerned this introduces a subtle hole in the semantics of IR auto-upgrade... but I guess it's unlikely to matter.

Some bits of the patch have weird indentation; please clang-format C++ code.

Should we be using Function::needsUnwindTableEntry() rather than Function::hasUWTable()?

chrib added a comment.Sep 8 2017, 2:12 AM

I'm sort of concerned this introduces a subtle hole in the semantics of IR auto-upgrade... but I guess it's unlikely to matter.

Some bits of the patch have weird indentation; please clang-format C++ code.

ah yes. thanks.

Should we be using Function::needsUnwindTableEntry() rather than Function::hasUWTable()?

I'm not sure. needsUnwindTableEntry checks !doesNotThrow in addition to hasUWTable so this is redundant here. The logic for arm is really to emit unwind annotation if the attribute is there, even if the function cantunwind (e.g doesNotThrow),

chrib updated this revision to Diff 117142.Sep 29 2017, 7:17 AM

Rebase. Update tests.

chrib updated this revision to Diff 135611.Feb 23 2018, 2:37 AM

The rebased llvm part, for ping.

many thanks

Christian

espindola edited reviewers, added: espindola; removed: rafael.Mar 15 2018, 9:50 AM