Skip to content

Add arm64 macOS support in the build system - #656

Open
shym wants to merge 4 commits into
Solo5:mainfrom
shym:macos
Open

Add arm64 macOS support in the build system#656
shym wants to merge 4 commits into
Solo5:mainfrom
shym:macos

Conversation

@shym

@shym shym commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

This PR is another take (compare with #641) to add some support for building on arm64 macOS. It is built on top of #655 and adds only 4 commits.
It is designed to make no difference for currently supported platforms.

The main changes are:

  • a new --disable-elftool configure option (that does what you’d expect),
  • a new --path-prepend configure option, to add new entries in PATH before invoking tools in the toolchain wrappers; this is necessary to be able to use homebrew’s llvm and lld packages (which we need to generate ELF unikernels) which do not install the binaries in a directory in PATH to avoid conflicts with versions of the same tools provided by macOS,
  • new cases in configure.sh to enable arm64 macOS.

Compared with #641, this PR doesn’t modify opam packages and leave such a change for another PR.

shym added a commit to shym/ocaml-solo5 that referenced this pull request Jul 20, 2026
This CI workflow illustrates how this PR plays with changes from
Solo5/solo5#656 and from mirage#177
It should be amended to follow updates on those other changes
shym added a commit to shym/ocaml-solo5 that referenced this pull request Jul 20, 2026
This CI workflow illustrates how this PR plays with changes from
Solo5/solo5#656 and from mirage#177
It should be amended to follow updates on those other changes
Comment thread configure.sh
--path-prepend=VAL
Prepend VAL to PATH in toolchain. For instance:
--path-prepend=/usr/local/llvm-21/bin:
(note the required explicit ':' separator at the end)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is the requirement to include the colon a convention? I would prefer that we (./configure.sh) are the ones to add the colon, or that this be verified.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree.
The initial rationale was thinking about portability to Windows (which is still a step further, I admit). But on second thought, as we are using those in sh scripts, I’d guess that even Windows’ sh would take care of interpreting :. So I went in #658 with adding the separator in the configure script, and while at it, support various occurrences of the option.

Comment thread configure.sh
# instructions with which a negative offset is admissible
# Is there a better fix?
# Because of this doubt, make it overridable, unlike in the other case
TARGET_CC_CFLAGS="${TARGET_CC_CFLAGS:--mtls-size=32}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I need more time to understand the implication of that and it seems really tricky.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I’d like to understand better where the breaking relocation is located. My guess is that clang makes assumptions about the layout that will be used in the linker script so that it assumes the offset will be positive and that those assumptions are not held in our linker scripts but I didn’t understand the full story there.

@dinosaure dinosaure left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can probably split out DISABLE_ELFTOOL into another PR which more general and can be easily acceptable for Solo5. I have some reservations about path-prepend (although the idea seems ok to me). Finally, we'll take the time to understand -mtls-size 32 and its implications.

@shym

shym commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

I extracted #657 and #658. Let’s take some more time to understand what is happening with those relocations.

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.

2 participants