-
-
Notifications
You must be signed in to change notification settings - Fork 680
Feature: Do not reuse different architecture version of temporary APE Loader on Darwin #1410
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
base: master
Are you sure you want to change the base?
Conversation
Bence, thank you for your contribution! It's an interesting approach that I think may work (although I'm also not sure if it breaks anything for others). As a first time contributor, could you check instructions in CONTRIBUTING.md? |
Well, sure, I've started, and then got distracted after the send email part. Will move on now. UPDATE: Okay, so formatting is done now. Imho it makes code harder to read here but this is the case with auto-formatters usually... Not sure if there is anything else I missed? |
if ((p = getenv("TMPDIR"))) { | ||
UnveilIfExists( | ||
__join_paths(buf, sizeof(buf), p, ".ape-" APE_VERSION_STR), "rx"); | ||
UnveilIfExists(__join_paths(buf, sizeof(buf), p, | ||
".ape-" APE_VERSION_STR GetXnuSuffix()), | ||
"rx"); | ||
} | ||
if ((p = getenv("HOME"))) { | ||
UnveilIfExists( | ||
__join_paths(buf, sizeof(buf), p, ".ape-" APE_VERSION_STR), "rx"); | ||
UnveilIfExists(__join_paths(buf, sizeof(buf), p, | ||
".ape-" APE_VERSION_STR GetXnuSuffix()), | ||
"rx"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably these could be wrapped in a condition as well to only run on xnu, but I don't know what / if there is an appropriate check available in this context.
Addresses #1409
So I thought I'll attempt to address the issue which caused me large headache few days ago.
My goal with this PR is to create the temporary APE loader in different files per architecture on Apple Silicon Mac:
${TMPDIR:-${HOME:-.}}/.ape-1.10-x86_64
${TMPDIR:-${HOME:-.}}/.ape-1.10-arm64
+${TMPDIR:-${HOME:-.}}/.ape-1.10-arm64.c
This way one can use Cosmo apps with both Rosetta and native ARM mode, even at the same time (without installing APE loader and manually setting up different versions and manipulating the PATH per architecture).
What I actually don't understand is why it appears that the same logic is implemented twice:
The code from
ape/ape.S:613
andtool/build/apelink.c:2019
seems to do the same thing.I have attempted to make sure they behave the same in my PR as well, but actually I don't know what
ape/ape.S
does or when it is used, so I could not test if they indeed are fully compatible after my changes.As far as I could, I tested it and it worked nice in my environment. One of the big questions is if it breaks anything for others?