Skip to content

Conversation

@jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Oct 29, 2025

Adds support in crossgen2 for emitting Mach-O objects.

Does not yet do the runtime support as that depends on #120777

@jkoritzinsky
Copy link
Member Author

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky
Copy link
Member Author

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@jkoritzinsky
Copy link
Member Author

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky
Copy link
Member Author

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky
Copy link
Member Author

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

private protected override void EmitSymbolRangeDefinition(string rangeNodeName, string startSymbolName, string endSymbolName)
{
// Mach has a few characteristics that make range symbols more difficult to emit:
// - Emitting two symbols in the same location is not well supported by the Apple linker.
Copy link
Member

Choose a reason for hiding this comment

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

For my own education - do you refer here to start and end symbols?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've been told that the apple linker has issues when you define two symbols at the same address.

To emit our symbol range concept (where the begin and end of a range are both pointing at existing symbols), the common implementation would emit a start symbol definition at the same symbol as the first symbol in the range.

As a result, we have a custom implementation for MachO (which is actually really nice with the subtractor relocs so we can truly represent the symbol range within the Mach format).

if (!_definedSymbols.TryGetValue(startNodeName, out var startSymbol)
|| !_definedSymbols.TryGetValue(endNodeName, out var endSymbol))
{
throw new InvalidOperationException("The symbols defined by a symbol range must be emitted into the same object.");
Copy link
Member

Choose a reason for hiding this comment

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

I have seen string.Format(SR.Error..., format) used in one of the files before

Copy link
Member Author

Choose a reason for hiding this comment

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

We use string.Format for user-facing errors. This would be a bug in ILC, so we aren't using the localized formatting as any time a user sees this would be a bug.

@jkoritzinsky
Copy link
Member Author

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants