Skip to content

Suppress .eh_frame generation when EXECUTORCH_OPTIMIZE_SIZE is ON#17906

Merged
lucylq merged 14 commits intomainfrom
gh/lucylq/136/head
Mar 6, 2026
Merged

Suppress .eh_frame generation when EXECUTORCH_OPTIMIZE_SIZE is ON#17906
lucylq merged 14 commits intomainfrom
gh/lucylq/136/head

Conversation

@lucylq
Copy link
Contributor

@lucylq lucylq commented Mar 5, 2026

Add -fno-asynchronous-unwind-tables and -fno-unwind-tables to both
CXX and C release flags when EXECUTORCH_OPTIMIZE_SIZE is enabled.
This eliminates .eh_frame/.eh_frame_hdr sections from the runtime
libraries, which is safe because ExecuTorch already builds with
-fno-exceptions.

For each function, .eh_frame stores a compact description of how to restore the previous stack frame

  • where registers are saved
  • how to find the return address
  • how the stack ptr changed for each instruction.

Caveats, when OPTIMIZE_SIZE is on

  • Can't run gdb
  • Can't run perf tooling

Reduces stripped size_test by 8,192 bytes (14.6%) and stripped
size_test_all_ops by 143,360 bytes (8.6%).

Github Executorch added 2 commits March 5, 2026 09:08
[ghstack-poisoned]
[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 5, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17906

Note: Links to docs will display an error until the docs builds have been completed.

⚠️ 1 Awaiting Approval, 36 Pending

As of commit f613426 with merge base 411061f (image):

AWAITING APPROVAL - The following workflow needs approval before CI can run:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Github Executorch added 6 commits March 5, 2026 10:54
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
Github Executorch added 2 commits March 6, 2026 10:58
[ghstack-poisoned]
[ghstack-poisoned]
Base automatically changed from gh/lucylq/135/head to main March 6, 2026 22:24
@lucylq lucylq requested a review from JacobSzwejbka as a code owner March 6, 2026 22:24
[ghstack-poisoned]
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

[ghstack-poisoned]
Copilot AI review requested due to automatic review settings March 6, 2026 22:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Github Executorch added 2 commits March 6, 2026 15:01
[ghstack-poisoned]
[ghstack-poisoned]
Copilot AI review requested due to automatic review settings March 6, 2026 23:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +233 to +235
set(CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} -fno-exceptions -fno-rtti -fno-asynchronous-unwind-tables -fno-unwind-tables"
)
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says the change only adds -fno-asynchronous-unwind-tables/-fno-unwind-tables, but this hunk also adds -fno-exceptions and -fno-rtti to CMAKE_CXX_FLAGS_RELEASE. Please update the PR description (or drop the extra flags) so reviewers/users understand the full behavior change.

Copilot uses AI. Check for mistakes.
@lucylq lucylq merged commit 1143673 into main Mar 6, 2026
152 of 160 checks passed
@lucylq lucylq deleted the gh/lucylq/136/head branch March 6, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants