refactor: fix definition of LFS64-related types in emscripten#5142
refactor: fix definition of LFS64-related types in emscripten#5142dybucc wants to merge 1 commit into
Conversation
|
Style check fails for reasons outside the changes introduced in this PR. The formatting checks seem |
21a8c5d to
9cdfb82
Compare
This comment has been minimized.
This comment has been minimized.
9cdfb82 to
4ce5a85
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot blocked Holding off until there is a good alternative to off64_t |
|
(https://snoozeth.is/FoBvqh9wkR8) I will wait until Wed, 19 Aug 2026 08:32:43 UTC and then add label S-waiting-on-review and remove label S-blocked. @rustbot claim. |
|
Actually I think I'm missing something - what does this PR fix? I only see it adding deprecation warnings and deleting |
|
The At the time of opening the PR, I forgot to mention it, but the folks in emscripten do things a bit differently with And then this transitively applies to the affected records that use these types. Finally, there's the fact that the PR itself was opened as a draft to first get confirmation on the changes. If they were viable, then I would go ahead an update all of the top-level |
4ce5a85 to
334a733
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
The definitions for types that were made available under the LFS64 spec were being exposed even when the right feature test macro for that is now `FILE_OFFSET_BITS64`. This has been patched by deprecating the current definition when building without the existing `gnu_file_offset_bits64` `cfg` option. Even though the definitions are exposed when both the afore mentioned macro and the `_GNU_SOURCE` macro are defined, no `cfg` has been added for the latter.
334a733 to
145ecb7
Compare
Description
This PR addresses bit-width representation issues under emscripten concerned with the LFS64 "spec." The current interface we expose unconditionally makes the symbols available, even though the upstream musl fork for emscripten does define the
_GNU_SOURCEfeature test macro by default. This has been patched by conditionally compiling whenever it is that thegnu_file_offset_bits64cfgoption is detected at build time.All of the routines concerned with LFS64 were already in a module of their own but were always exposed even though they are not always available in emscripten. According to [1], the
_LARGEFILE64_SOURCEfeature test macro is considered "deprecated" and the gated functionality should instead be provided by setting_FILE_OFFSET_BITS=64. At present, thelibccrate aleady has acfgfor that. Still, the definition in emscripten (and in upstream musl) also requires the_GNU_SOURCEfeature test macro to be enabled. This symbol is not made available by default in Linux unless either explicitly defined in source code or as part of the compilation pipeline, and makes available a number of GNU extensions. Thelibccrate does not have at the time of writing anycfgs gating this functionality, but this PR does not introduce it. Further discussion on this may be necessary.This patch deprecates all such symbols (both suffixed routines and types) unless the
cfgoption is set. These changes, though, may prove to be useless. That's why no greater effort has been made into fixing the exposed interface, unless further confirmation from somebody else is provided. Tests don't pass with the module availability changes as there's overlapping definitions between parent modules to theemscriptenmodule, and those in theemscriptenmodule itself. This is caused by the modified link names of a few routines when running undergnu_file_offset_bits64. Were this PR to be viable, further changes will be made to fully fix this.Sources
Upstream emscripten sources showing both the final
alltypes.hheader with theoff_tdefinition and the input to thesedscript that generates it.Upstream emscripten fork of musl showing what has been assumed to be the "main" definition of
off64_tand related types when both the_GNU_SOURCEand_LARGEFILE64_SOURCEfeature testmacros are present.
Checklist
libc-test/semverhave been updated*LASTor*MAXare included (see #3131)cd libc-test && cargo test --target mytarget); especially relevant for platforms that may not be checked in CI