-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Initial fixes for macOS <10.9 and PowerPC #21655
base: main
Are you sure you want to change the base?
Conversation
@dotnet-policy-service agree |
kern_return_t mach_ret; | ||
|
||
if (pid == getpid ()) { | ||
/* task_for_pid () doesn't work on ios, even for the current process */ |
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.
could be simplified unless you also want to target legacy iOS
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.
iOS is not my concern, so how better to rewrite this chunk?
@@ -3706,41 +3785,76 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) | |||
*/ | |||
g_assert (!cfg->method->save_lmf); | |||
/* | |||
* Note: we can use ppc_r12 here because it is dead anyway: | |||
* we're leaving the method. | |||
* Note: we can use ppc_r12 (ppc_r11 on Darwin) here because it is dead |
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.
i think instead of ifdef on every site where r11/r12 is referenced, it would be best to put this as a define ifdef'd on OS and use that for the simple r11 vs. r12 cases, and save ifdef for the more complex ABI differences
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.
Let’s perhaps see what upstream says. That was my initial idea, but then I thought it may introduce extra complications down the road.
* (C) 2023 Xamarin, Inc. | ||
*/ | ||
|
||
/* The code below assumes 10.5.x or 10.6.x (10A190 or Rosetta). |
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.
i'll note my previous half-hearted attempt was on 10.4, so this might explain why you had better success :)
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.
@NattyNarwhal Tiger is painful to develop for. I have a 10.4.11 set-up to run builds or test, but don’t really have motivation or time to work on it. 10.5.8 and 10A190/10.6.8 are reasonably homogeneous, on the other hand.
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.
(Registers are not prefixed on Tiger, so to support it here we need to add defines which would add __
on >10.4, but not on <10.5. This is not hard, just extra code, but I have no idea if the rest of the code needs extra modifications.)
* (C) 2023 Xamarin, Inc. | ||
*/ | ||
|
||
/* The code below assumes 10.5.x. |
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.
comment could be dropped; IIRC ppc64 was introduced in 10.5
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.
AFAIK 10.4.11 does support ppc64
, at least to some extent.
Rebased to fix a typo in |
Note that active development of mono is done in the dotnet/runtime repository. |
So should I open a new PR there and close this one, or this can be rebased? |
It would be better to submit to dotnet/runtime and later backport here, we have better CI there. |
For the general PPC code I agree dotnet/runtime would be better, but I don't think we'll want to take any macOS <10.9 fixes there since a lot of that repo assumes much newer macOS. |
@akoeplinger @vargaz So what should I do? :) |
Provides a fallback for older macOS after the following commit has broken build there: mono@db5f384
Usage of r11/r12 was reversed for the sake of ELFv2 in mono@02cdf6a We do not need that change to apply for macOS, so make it conditional.
f061b85
to
c658152
Compare
@@ -3148,8 +3148,13 @@ emit_reserve_param_area (MonoCompile *cfg, guint8 *code) | |||
if (ppc_is_imm16 (-size)) { | |||
ppc_stwu (code, ppc_r0, -size, ppc_sp); | |||
} else { | |||
#if defined(__POWERPC__) |
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.
Is this needed ? Its a mips file.
@@ -2763,6 +2763,40 @@ arch_emit_imt_trampoline (MonoAotCompile *acfg, int offset, int *tramp_size) | |||
|
|||
code = buf; | |||
|
|||
#if defined(TARGET_OSX) | |||
/* Load the mscorlib got address */ |
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.
Can all these changes be simplified by defining a tmp_reg or something which is r11 on apple and r12 elsewhere ?
Feedback is welcome.
These fixes are needed, but not sufficient. However this is good enough for the first PR, I believe.
Current status of the build on macOS PPC in the issue link below.
@marek-safar This fixes errors reported in #21649
@susematz Please review r11/r12 commit. Initially I thought to make defines to switch these registers in the code, but then decided to put Darwin code into separate chunks – this will make it easier to modify it as needed without affecting anything else.
@NattyNarwhal If you could take a look too, please.