Add arm64 macOS support in the build system - #656
Conversation
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
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
Add a new option so that the toolchain can invoke commands with an extended `PATH`
| --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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| # 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}" |
There was a problem hiding this comment.
I need more time to understand the implication of that and it seems really tricky.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
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:
--disable-elftoolconfigure option (that does what you’d expect),--path-prependconfigure option, to add new entries inPATHbefore invoking tools in the toolchain wrappers; this is necessary to be able to use homebrew’sllvmandlldpackages (which we need to generate ELF unikernels) which do not install the binaries in a directory inPATHto avoid conflicts with versions of the same tools provided by macOS,configure.shto enable arm64 macOS.Compared with #641, this PR doesn’t modify opam packages and leave such a change for another PR.