Skip to content

Conversation

@filipnavara
Copy link
Member

@filipnavara filipnavara commented Sep 21, 2023

The flag tells the linker that there are no functions with overlapping code and thus the code sections can be divided into subsections based on the symbols. This is similar in effect to how -ffunction-sections behaves on ELF.

Notably, this enables optimization such as dead code stripping and identical code folding, if requested through linker switches.

Old ld64 linker tends to run into deep stack loop without this switch if -dead_strip is used (encountered in Xamarin, not used by regular NativeAOT), and often ends up stack overflowing. New Xcode 15+ linker completely fails to produce correct unwind tables without this flag, which results in the NativeAOT executables crashing during GC or on first stack walk.

@filipnavara
Copy link
Member Author

cc @agocke @ivanpovazan

@ivanpovazan
Copy link
Member

Thank you for looking into this.
Would this mean we can reenable the -dead_strip flag in Xamarin builds: dotnet/macios#18605 ?

@filipnavara
Copy link
Member Author

Would this mean we can reenable the -dead_strip flag in Xamarin builds: xamarin/xamarin-macios#18605 ?

We can give it another try... this may not be the full solution but it may help enough to make a difference.

I am mainly submitting this as a fix for the Xcode 15 crashes.

@lambdageek lambdageek merged commit f8b9dcb into dotnet:dotnet/main-16.x Sep 22, 2023
@lambdageek
Copy link
Member

lambdageek commented Sep 22, 2023

/backport to dotnet/release/8.0

bot doesn't work here. i'll open backport PRs by hand

carlossanlop pushed a commit that referenced this pull request Sep 22, 2023
#471) (#472)

The flag tells the linker that there are no functions with overlapping code and thus the code sections can be divided into subsections based on the symbols. This is similar in effect to how `-ffunction-sections` behaves on ELF.

Notably, this enables optimization such as dead code stripping and identical code folding, if requested through linker switches.

Old ld64 linker tends to run into deep stack loop without this switch if `-dead_strip` is used (encountered in Xamarin, not used by regular NativeAOT), and often ends up stack overflowing. New Xcode 15+ linker completely fails to produce correct unwind tables without this flag, which results in the NativeAOT executables crashing during GC or on first stack walk.

Co-authored-by: Filip Navara <[email protected]>
radekdoulik pushed a commit to radekdoulik/llvm-project that referenced this pull request May 9, 2024
dotnet#471)

The flag tells the linker that there are no functions with overlapping code and thus the code sections can be divided into subsections based on the symbols. This is similar in effect to how `-ffunction-sections` behaves on ELF.

Notably, this enables optimization such as dead code stripping and identical code folding, if requested through linker switches.

Old ld64 linker tends to run into deep stack loop without this switch if `-dead_strip` is used (encountered in Xamarin, not used by regular NativeAOT), and often ends up stack overflowing. New Xcode 15+ linker completely fails to produce correct unwind tables without this flag, which results in the NativeAOT executables crashing during GC or on first stack walk.
akoeplinger pushed a commit that referenced this pull request May 17, 2024
#471)

The flag tells the linker that there are no functions with overlapping code and thus the code sections can be divided into subsections based on the symbols. This is similar in effect to how `-ffunction-sections` behaves on ELF.

Notably, this enables optimization such as dead code stripping and identical code folding, if requested through linker switches.

Old ld64 linker tends to run into deep stack loop without this switch if `-dead_strip` is used (encountered in Xamarin, not used by regular NativeAOT), and often ends up stack overflowing. New Xcode 15+ linker completely fails to produce correct unwind tables without this flag, which results in the NativeAOT executables crashing during GC or on first stack walk.
radekdoulik pushed a commit that referenced this pull request Aug 16, 2024
#471)

The flag tells the linker that there are no functions with overlapping code and thus the code sections can be divided into subsections based on the symbols. This is similar in effect to how `-ffunction-sections` behaves on ELF.

Notably, this enables optimization such as dead code stripping and identical code folding, if requested through linker switches.

Old ld64 linker tends to run into deep stack loop without this switch if `-dead_strip` is used (encountered in Xamarin, not used by regular NativeAOT), and often ends up stack overflowing. New Xcode 15+ linker completely fails to produce correct unwind tables without this flag, which results in the NativeAOT executables crashing during GC or on first stack walk.
radekdoulik pushed a commit that referenced this pull request Sep 2, 2024
#471)

The flag tells the linker that there are no functions with overlapping code and thus the code sections can be divided into subsections based on the symbols. This is similar in effect to how `-ffunction-sections` behaves on ELF.

Notably, this enables optimization such as dead code stripping and identical code folding, if requested through linker switches.

Old ld64 linker tends to run into deep stack loop without this switch if `-dead_strip` is used (encountered in Xamarin, not used by regular NativeAOT), and often ends up stack overflowing. New Xcode 15+ linker completely fails to produce correct unwind tables without this flag, which results in the NativeAOT executables crashing during GC or on first stack walk.
radekdoulik pushed a commit that referenced this pull request Sep 12, 2024
#471)

The flag tells the linker that there are no functions with overlapping code and thus the code sections can be divided into subsections based on the symbols. This is similar in effect to how `-ffunction-sections` behaves on ELF.

Notably, this enables optimization such as dead code stripping and identical code folding, if requested through linker switches.

Old ld64 linker tends to run into deep stack loop without this switch if `-dead_strip` is used (encountered in Xamarin, not used by regular NativeAOT), and often ends up stack overflowing. New Xcode 15+ linker completely fails to produce correct unwind tables without this flag, which results in the NativeAOT executables crashing during GC or on first stack walk.
radekdoulik pushed a commit that referenced this pull request Sep 19, 2024
#471)

The flag tells the linker that there are no functions with overlapping code and thus the code sections can be divided into subsections based on the symbols. This is similar in effect to how `-ffunction-sections` behaves on ELF.

Notably, this enables optimization such as dead code stripping and identical code folding, if requested through linker switches.

Old ld64 linker tends to run into deep stack loop without this switch if `-dead_strip` is used (encountered in Xamarin, not used by regular NativeAOT), and often ends up stack overflowing. New Xcode 15+ linker completely fails to produce correct unwind tables without this flag, which results in the NativeAOT executables crashing during GC or on first stack walk.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants