windows(gnu): link to 32-bit time routines in x86 and add test#5059
Conversation
This comment has been minimized.
This comment has been minimized.
9a434dd to
c8cb7bc
Compare
5a75a87 to
a5c7202
Compare
This comment has been minimized.
This comment has been minimized.
0021301 to
4e83e2d
Compare
4e83e2d to
8c5047b
Compare
This comment has been minimized.
This comment has been minimized.
8c5047b to
320bd3c
Compare
This comment has been minimized.
This comment has been minimized.
320bd3c to
f858022
Compare
This comment has been minimized.
This comment has been minimized.
f858022 to
2bd4191
Compare
This comment has been minimized.
This comment has been minimized.
2bd4191 to
cdbd6e6
Compare
This comment has been minimized.
This comment has been minimized.
cdbd6e6 to
b7c9250
Compare
This comment has been minimized.
This comment has been minimized.
b7c9250 to
0ef0992
Compare
This comment has been minimized.
This comment has been minimized.
0ef0992 to
61d8568
Compare
This comment has been minimized.
This comment has been minimized.
61d8568 to
f1fd3c7
Compare
This comment has been minimized.
This comment has been minimized.
ebdef8a to
8b5714c
Compare
| assert_ne!(time_values[0], 123); | ||
| assert_eq!(time_values[1], 456); |
There was a problem hiding this comment.
Suggested comment based on #5032 (comment):
If only the first array value is written, libc's
time_tis accurate for what the functiontimeexpects. If both array values wind up overwritten, we are probably linking a version oftimethat expects 64-bittime_twhile ourtime_tis only 32 bits.
Also can you confirm that this fails with the current version?
There was a problem hiding this comment.
I can. CI doesn't catch this because we skip over time_t on Windows. I removed that in #5062.
| // Under Windows x86 with GNU, `time_t` is still 32-bit wide on stable, so | ||
| // these routines have to link with their 32-bit variants. | ||
| cfg_if! { | ||
| if #[cfg(all(target_arch = "x86", target_env = "gnu", not(gnu_time_bits64)))] { |
There was a problem hiding this comment.
Move anything gnu_time_bits64 bit to #5062, since it's not getting fully tested here and that PR doesn't currently do anything on its own.
There was a problem hiding this comment.
I meant only the not(gnu_time_bits64) bit of the config, given the test failures and lack of it being tested. The link fixes are fine, that should be in this PR because it's a standalone fix.
Though if it's easier for you at this point to roll the two PRs together, that's fine too
There was a problem hiding this comment.
Reverted and done. This PR should then be merged first. I'll solve the conflicts in #5062 then.
EDIT: No good. Reverted again. The linking issues remain solved in this PR. The other one will have to add the condition to the predicate once this one gets merged.
|
Reminder, once the PR becomes ready for a review, use |
8b5714c to
b0393bb
Compare
This comment has been minimized.
This comment has been minimized.
b0393bb to
875f211
Compare
time_t functionstime_t
875f211 to
a9ee123
Compare
This comment has been minimized.
This comment has been minimized.
3dcc67c to
9bfedc2
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. |
Link to the correct routines in Windows x86 GNU. These were not linked before. They expected a 64-bit `time_t`. This is not the bit width exposed in `libc` for `time_t` in that target triple.
a07e2c5 to
c5d3c12
Compare
time_t|
Question: why doesn't this cause the function pointer comparison tests to fail on win32-gnu? |
Function pointer checks are skipped on Windows [1]. I've tried to look into this. I haven't found the reason why stuff is failing. The decorated names in MSVC seem to use |
|
Only on MSVC or on GNU as well? We could at least limit the skips if it's the former. Calling convention shouldn't affect the function pointer checks regarding address mismatches. It would be nice if we could check calling convention in ctest somehow but I don't believe those mismatches show up anywhere. You might get a hint if you make a Rust library where you call a |
|
Mind just opening a new issue with your findings so we don't lose this? |
|
It happens on both MSVC and GNU. Just opened the issue. |
Description
Until #5032, whenever
libcwas running under Windows x86 with GNU, the defaultbit-width of
time_tvalues was 32-bits. This doesn't quite align with the defaults in MSVC andmingw, but that's been addressed in that PR.This PR is a quick patch for stable, as the changes in #5032 are not
backwards-compatible. It separates the routines that under Windows use
time_tvalues and changestheir link-time symbols to the 32-bit variants exposed in both MSVC and
mingw, for the affectedtarget platform/environment.
It also adds a test, akin to the one in #5032, that should ensure the correct
bit-widths are in use for both the types and the linked routine symbols.
Note that if both #5062 and this PR are to be merged, it's preferable to merge first #5062, as this
PR will then incorporate support for the
cfgintroduced in that PR.Sources
None. If any, the same as #5032 as this stems from it.
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
@rustbot label +stable-nominated