Skip to content

Fix exe size for Mach-O files#89325

Merged
agocke merged 3 commits intodotnet:mainfrom
agocke:no-sym-export
Jul 22, 2023
Merged

Fix exe size for Mach-O files#89325
agocke merged 3 commits intodotnet:mainfrom
agocke:no-sym-export

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.
@agocke agocke requested a review from MichalStrehovsky as a code owner July 21, 2023 20:20
@ghost ghost assigned agocke Jul 21, 2023
@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
@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