Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exe size for Mach-O files #89325

Merged
merged 3 commits into from
Jul 22, 2023
Merged

Fix exe size for Mach-O files #89325

merged 3 commits into from
Jul 22, 2023

Conversation

agocke
Copy link
Member

@agocke agocke commented Jul 21, 2023

The extra size appears to be the export list, which is zeroed but not removed when the file is stripped. Exes shouldn't have any exported symbols by default, but ld will include everything by default. We'll fix it up using an ld flag.

Fixes #86707

The extra size appears to be the export list, which is zeroed
but not removed when the file is stripped. Exes shouldn't have
any exported symbols by default, but ld will include everything
by default. We'll fix it up using an ld flag.
@ghost
Copy link

ghost commented Jul 21, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

The extra size appears to be the export list, which is zeroed but not removed when the file is stripped. Exes shouldn't have any exported symbols by default, but ld will include everything by default. We'll fix it up using an ld flag.

Fixes #86707

Author: agocke
Assignees: -
Labels:

area-NativeAOT-coreclr

Milestone: -

@agocke
Copy link
Member Author

agocke commented Jul 21, 2023

Thinking about how to test this, but haven't been able to find a good answer. The linkedit segment is smaller after this change, but the symbols listed by nm are the same.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thank you!

@jkotas
Copy link
Member

jkotas commented Jul 21, 2023

The build fails with: ld: unknown option: -no_exported_symbols

Looks like this option was added only very recently and it is not present in our current XCode version yet: llvm/llvm-project@272bf0f

@agocke agocke merged commit 2d1e284 into dotnet:main Jul 22, 2023
113 of 116 checks passed
@agocke agocke deleted the no-sym-export branch July 22, 2023 06:44
@ghost ghost locked as resolved and limited conversation to collaborators Aug 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NativeAOT produces very large __LINKEDIT segment on macOS
2 participants