-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Update auxvec.h for Android and Linux #3125
base: main
Are you sure you want to change the base?
Update auxvec.h for Android and Linux #3125
Conversation
r? @JohnTitor (rustbot has picked a reviewer for you, use r? to override) |
Thanks for the PR! |
This is scoped to Linux-likes alone, so it does not affect Xous to begin with. I am not sure why you are bringing that OS up. I believe it is appropriate here because Android and Linux share this header, as they are in fact both Linux. In fact it is not clear to me that the 32-bit Android does not expose these auxiliary vector constants, though I would have to do slightly more research to confirm or deny either way. And the I am aware that replicating the exact structure of the uapi headers is probably inappropriate, but duplicating data when they do share an exact copy of a header just allows people to add support to Linux or Android but not cover the other platform and allow one to go unsupported. This introduces needless divergence in functionality for a set of bindings that, I would think, is supposed to enable cross-platform functionality. |
If my hunch is correct and these constants are also defined for the benefit of Android 32-bit userspace (again, I haven't checked yet), then there would not need to be any configuration here if it were not for emscripten, honestly. I am not sure why that "OS" is classified as Linux-like. |
It may work fine for you, but I personally think the lack of structure is confusing because it results in things like |
I'm repeating but it adds an entirely different structure, and it confuses contributors, like "which ways should I follow? target-based or header-based". |
For some reason glibc and musl both believe it is appropriate to globally define this, invariant of architecture. Okay, I guess?! They're the C libs, I'll believe them. I did some checking and I am 100% certain that getauxval is defined as of Android NDK 18 (which will soon become lower than the minimum) and 95% sure that all the same constants are defined on 32-bit and 64-bit, since the NDK specifically recommends using getauxval it to introspect on AT_HWCAPS for Thumb instructions where appropriate. Will doublecheck after I get some more sleep. 100% sure that Emscripten defines all the same constants in their musl fork: I assume the Emscripten "kernel" doesn't provide any useful information when the auxiliary vector is queried but no worries, user code wasn't promised a better response than ENOENT when it runs getauxval. So assuming I don't turn up any last-minute gotchas in my doublechecking, the fix is that this should all be without cfg. I suppose I will simply put it in the same mod.rs instead, without cfg. I presume that will be an acceptable approach to reducing needless duplication? |
ea657a9
to
426c088
Compare
I cannot find a single thing to indicate these are unavailable or conditionally-available constants in the AArch32 case, considering you literally cannot use Except for They are also important because other systems, like FreeBSD, define some of these constants, and for all I know they give them values in the millions instead. It's a ulong. It has space for that. These systems don't offer |
That is to say: |
Fair enough, thanks! @bors r+ |
Unify **/uapi/linux/auxvec.h in linux_like/mod.rs The NDK automatically generates this from Linux kernel headers. It seems best to simply unify these, since where the kernel goes, Android will undoubtedly follow. Also, note relevant versions. New in this patch: `AT_MINSIGSTKSZ` This const is needed to handle new extensions to platform arches that add state to save to signal stacks, replacing `MINSIGSTKSZ` with an ELF-loaded equivalent.
💔 Test failed - checks-actions |
...Oookay, so the Emscripten toolchain uses the musl libc last I checked but they just... omit... half the libc...? I mean fine, I guess! I would have expected they took the "don't return a useful answer" route (which software should be prepared for) instead of "don't support getauxval entirely", but sure sure sure. I'm going to split things back up a little so we can land the "add the constants to all the actually Linux environments" and then I am going to reimplement the simplifying change by making a pass at #1915 |
These values are universal across architectures, as they are defined primarily by the Linux UAPI. Thus adding them to only 64-bit was in error.
These values are universal across architectures, as they are defined primarily by the Linux UAPI. They are also echoed exactly by musl and glibc.
6bdd606
to
bca14be
Compare
Okay, finally back to this! Sorry for taking so long! |
I have no idea what the Cirrus CI failures are all about. |
Some return values require special thought in Rust, e.g. addresses that may violate "strict provenance", or ones with special, hardware-specific meaning. So note when the return value is meant to be an address or has platform-specific interpretation.
a66f600
to
fa3fa1d
Compare
I added some comments to some of the ELF |
@bors r+ |
Update auxvec.h for Android and Linux The NDK automatically generates these constants from Linux kernel headers, and they are available for all architectures. They are also repeated by musl and glibc, though this is mostly just a restatement to make use with getauxval more convenient. New in this patch: `AT_MINSIGSTKSZ` This const is needed to handle new extensions to platform arches that add state to save to signal stacks, replacing `MINSIGSTKSZ` with an ELF-loaded equivalent.
💔 Test failed - checks-actions |
Update auxvec.h for Android and Linux The NDK automatically generates these constants from Linux kernel headers, and they are available for all architectures. They are also repeated by musl and glibc, though this is mostly just a restatement to make use with getauxval more convenient. New in this patch: `AT_MINSIGSTKSZ` This const is needed to handle new extensions to platform arches that add state to save to signal stacks, replacing `MINSIGSTKSZ` with an ELF-loaded equivalent.
💔 Test failed - checks-actions |
Failed on i686:
|
@JohnTitor I don't really understand the nature of this test so I don't know what I'm supposed to be doing here? |
@workingjubilee it's just a test that the identifiers are available on the host platforms, which I guess that one wasn't. It would just need an exception added to Might be worth just rebasing to see if it works first, CI was updated kinda recently so maybe it fixed itself. |
The NDK automatically generates these constants from Linux kernel headers, and they are available for all architectures. They are also repeated by musl and glibc, though this is mostly just a restatement to make use with getauxval more convenient.
New in this patch:
AT_MINSIGSTKSZ
This const is needed to handle new extensions to platform arches that add state to save to signal stacks, replacing
MINSIGSTKSZ
with an ELF-loaded equivalent.