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

ObjWriter: Place unboxing section along other TEXT sections #97960

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,25 @@ private protected virtual void EmitDebugThunkInfo(
private void EmitObject(string objectFilePath, IReadOnlyCollection<DependencyNode> nodes, IObjectDumper dumper, Logger logger)
{
// Pre-create some of the sections
//
// The order of the sections should not necessarily matter. The old LLVM-based
// ObjWriter used to place the "text" and "managed code" sections first. Some
// versions of Apple's ld-prime linker (default linker for Xcode 15+) produce
// incorrect unwind tables when the TEXT sections are intertwined with other
// sections. In order to workaround that issue we also place the "unbox" section
// in a pre-defined order.
//
// See https://github.com/dotnet/runtime/issues/97745#issuecomment-1925915381
// Reported to Apple as FB13584275 and acknowledged as a bug in their linker.
GetOrCreateSection(ObjectNodeSection.TextSection);
if (_nodeFactory.Target.OperatingSystem == TargetOS.Windows)
{
GetOrCreateSection(ObjectNodeSection.UnboxingStubWindowsContentSection);
GetOrCreateSection(ObjectNodeSection.ManagedCodeWindowsContentSection);
}
else
{
GetOrCreateSection(ObjectNodeSection.UnboxingStubUnixContentSection);
GetOrCreateSection(ObjectNodeSection.ManagedCodeUnixContentSection);
}

Expand Down