-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
std.os.uefi: fix some mistakes #12897
Conversation
Yeah like leecannon mentioned, the old packed structs are equivalent to extern structs with all align(1). That's also the main reason I haven't gotten around to it, wanted to make some meta function to add the aligns instead of changing every struct because I am lazy |
Ah, okay! I see now. I figured that it would probably be more complicated. In that case I will exclude the bit size stuff for now so that we can add such a meta function and do the rest some other time. |
Now the issue with the stage1-only Well, I suppose we could conditionally load a different file in stage1. But I tried to look ahead a little bit and there are really a lot of |
Alright I've written one now so I'll go ahead and PR it and then we can use that if it goes through. |
I totally missed that #12761 already does part of this apparently. My PR still contains some other UEFI-specific fixes though. I guess either will have to rebase. |
Would you also be interested in me PRing your fork with the changes to the structs (maybe with a rebase to use CPacked) while we wait on that? |
Sure! I was kinda waiting for #12899 to be accepted/merged but I'm assuming it will probably be accepted in roughly that form, even if only temporarily until the language catches up and it will be possible to do that on a language level. |
Ah given the issue with decls I might wait for something else to show up - was just considering working on my project so I'd need a local fork to get it building anyways and figured it'd be good to pr if I did so. Might just go with adding |
I don't think #6709 is going to happen anytime soon either (and I'm no longer convinced it should be allowed anyway). |
Yeah, someone mentioned similar syntax in #10113 but I don't know of any issue for it. |
@MasterQ32
Can you elaborate on this plan? Like who is planning this? Is anyone keeping track of this or already working on it? |
I don't know why that one argument was discarded. Is there a reason? It failed to compile.
Would we want to add align(1) to every field while we don't have language support for something similar? It's a bit of a pain but as-is uefi is largely just unusable under stage 2 due to the lack of it. |
I would prefer doing that in another PR, if at all. #13009 is tagged for 0.10 so it might get more priority soon, but I don't know. So, I'm just waiting for this to be merged. |
Ah ok that sounds ideal |
Yes we do; as UEFI has Tier 2 support, we shouldn't be allowing it to regress. |
Thanks! |
This is an attempt to make
std.os.uefi
work with self-hosted (stage2); it is currently broken.With this PR, the following now works:
However, it doesn't work with stage1:
This error only happens with the old compiler. I can't really figure out why. It only started happening after I added
std.meta.FnPtr
.So I came here to get some feedback: is it fine to drop stage1 support for
std.os.uefi
? If so, we could also just use*const Fn
directly instead ofstd.meta.FnPtr(Fn)
wherestd.meta.FnPtr
is supposed to serve for compatibility with both stage1 and stage2.Also, the reason I changed all these
packed struct
s toextern struct
s is because some of them were containing arrays and as we all knowpacked struct
s can no longer have them so I thought that maybe these should all beextern struct
s anyway so I just changed them all.This might be wrong, which is why I'm asking for feedback or reviews.
CC @fifty-six