libc icon indicating copy to clipboard operation
libc copied to clipboard

Added ucontext_t for powerpc64-linux

Open mgiessing opened this issue 1 year ago • 12 comments

Description

This PR will add ucontext_t to powerpc64le-unknown-linux-gnu. The relevant header files this is linked to can be found here: https://github.com/bminor/glibc/blob/master/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h and for ucontext_t specifically here: https://github.com/bminor/glibc/blob/master/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h#L155-L196

Sources

Checklist

  • [X] Relevant tests in libc-test/semver have been updated
  • [X] No placeholder or unstable values like *LAST or *MAX are included (see #3131)
  • [X] Tested locally (cd libc-test && cargo test --target mytarget); especially relevant for platforms that may not be checked in CI

Testing throws an error, but that is not related to this PR as far as I can see. Even without the patch I see an error in the main branch

[...]
  cargo:warning=57833 |             }
  cargo:warning=      |             ^
  cargo:warning=/root/git/libc/target/powerpc64le-unknown-linux-gnu/debug/build/libc-test-0e970a92698d6386/out/main.c: In function ‘__test_fn_epoll_pwait2’:
  cargo:warning=/root/git/libc/target/powerpc64le-unknown-linux-gnu/debug/build/libc-test-0e970a92698d6386/out/main.c:57858:13: error: control reaches end of non-void function [-Werror=return-type]
  cargo:warning=57858 |             }
  cargo:warning=      |             ^
  cargo:warning=At top level:
  cargo:warning=cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
  cargo:warning=cc1: all warnings being treated as errors

  --- stderr
  rust version: 1.84.0-nightly


  error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-Wall" "-Wextra" "-Werror" "-Wno-unused-parameter" "-Wno-type-limits" "-Wno-address-of-packed-member" "-Wno-unknown-warning-option" "-Wno-deprecated-declarations" "-D_GNU_SOURCE" "-D__GLIBC_USE_DEPRECATED_SCANF" "-o" "/root/git/libc/target/powerpc64le-unknown-linux-gnu/debug/build/libc-test-0e970a92698d6386/out/4d9447838b1b2e62-main.o" "-c" "/root/git/libc/target/powerpc64le-unknown-linux-gnu/debug/build/libc-test-0e970a92698d6386/out/main.c" with args cc did not execute successfully (status code exit status: 1).

mgiessing avatar Oct 17 '24 13:10 mgiessing

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

rustbot avatar Oct 17 '24 13:10 rustbot

Related to https://github.com/rust-lang/libc/issues/3964

mgiessing avatar Oct 17 '24 13:10 mgiessing

I see there is an issue with the PR in regards to the usage of of c_double/float64.

error[E0277]: the trait bound `f64: core::cmp::Eq` is not satisfied
  --> src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs:43:9
   |
43 |         pub fp_regs: [::c_double; 33], // # define __NFPREG    33
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `core::cmp::Eq` is not implemented for `f64`, which is required by `[f64; 33]: core::cmp::Eq`
   |
   = help: the following other types implement trait `core::cmp::Eq`:
             i128
             i16
             i32
             i64
             i8
             isize
             u128
             u16
           and 4 others
   = note: required for `[f64; 33]` to implement `core::cmp::Eq`
note: required by a bound in `AssertParamIsEq`
  --> /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/cmp.rs:359:1
   = note: this error originates in the derive macro `Eq` which comes from the expansion of the macro `s` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `f64: Hash` is not satisfied
  --> src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs:43:9
   |
43 |         pub fp_regs: [::c_double; 33], // # define __NFPREG    33
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Hash` is not implemented for `f64`, which is required by `[f64; 33]: Hash`
   |
   = help: the following other types implement trait `Hash`:
             i128
             i16
             i32
             i64
             i8
             isize
             u128
             u16
           and 4 others
   = note: required for `[f64; 33]` to implement `Hash`
   = note: this error originates in the derive macro `Hash` which comes from the expansion of the macro `s` (in Nightly builds, run with -Z macro-backtrace for more info)

@JohnTitor Would you know what I need to change to make this pass? I tried to adapt based on the aarch64, loongarch64 & riscv64 version with the help of the powerpc64 glibc ucontext header file but apparently something's going wrong!

Any help is appreciated!

mgiessing avatar Oct 17 '24 14:10 mgiessing

@rustbot label stable-nominated

mgiessing avatar Oct 22 '24 12:10 mgiessing

I think this looks fine, but could you please add links to the relevant headers in the PR description?

tgross35 avatar Nov 06 '24 18:11 tgross35

@rustbot author

(just comment @rustbot review once the above is done)

tgross35 avatar Nov 06 '24 21:11 tgross35

@tgross35 Thanks for looking into this! I updated the PR description with the relevant header files.

mgiessing avatar Nov 06 '24 21:11 mgiessing

:umbrella: The latest upstream changes (presumably #4070) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Nov 17 '24 02:11 bors

@mgiessing this will need a rebase since the align module is gone now (which is a great thing 🎉)

tgross35 avatar Nov 19 '24 23:11 tgross35

I'm currently not having access to my laptop so the earliest I can work again on this will be mid of December, more probably beginning of next year :-)

mgiessing avatar Nov 20 '24 00:11 mgiessing

No worries! I'll mark this as a draft.

Any chance you know the answer to https://github.com/rust-lang/libc/pull/3986/files#r1831808892? If so, maybe somebody could pick this up to finish it.

tgross35 avatar Nov 20 '24 00:11 tgross35

Ah, although it is quite some time I believe I used signal.h for that:

image

https://refspecs.linuxbase.org/LSB_2.1.0/LSB-Core-PPC64/LSB-Core-PPC64.html

mgiessing avatar Dec 17 '24 09:12 mgiessing

@tgross35 Sorry for late response but I finally rebased this PR and integrated everything into mod.rs :) Could you have a look and let me know if there is some more work required or ready to merge? Thanks!

mgiessing avatar Apr 13 '25 21:04 mgiessing

@tgross35 just checking in - have you had a chance to look into this PR when you get a moment? No rush if you're busy :-)

mgiessing avatar Apr 23 '25 16:04 mgiessing

Sorry, this wasn't on my radar at all: it's marked as a draft and "S-waiting-on-author" :) I un-drafted it, you can update the latter by commenting @rustbot review when you have made these changes (or using the UI: image )

A few small comments above. Could you please also remove #[allow(missing_debug_implementations)]? The s/s_no_extra_traits macros should add it.

tgross35 avatar Aug 10 '25 06:08 tgross35

Posted PR https://github.com/rust-lang/libc/pull/4696 to continue the work from this PR.

xingxue-ibm avatar Sep 15 '25 22:09 xingxue-ibm

A few small comments above. Could you please also remove #[allow(missing_debug_implementations)]? The s/s_no_extra_traits macros should add it.

Done in the new PR.

xingxue-ibm avatar Sep 15 '25 22:09 xingxue-ibm