-
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
this fixes the siginfo_t compilation errors #181
this fixes the siginfo_t compilation errors #181
Conversation
I also added some missing externs for netbsd. |
@alexcrichton BTW, I'm 95% done with bootstrapping for NetBSD. My https://github.com/dhuseby/rust-cross-toolkit is able to get through the first three stages for NetBSD. It can build a stage0 rustc but the rustc segfaults when calling https://github.com/dhuseby/rust/blob/master/src/libstd/sys/unix/stack_overflow.rs#L131 For some reason, the compiler emits code to call the signal 13 compatibility trampoline code instead of just calling the main sigaction syscall. That's as far as I've gotten in the debugging. I need to install some debug symbols and debug the NetBSD kernel to see why it's returning ENOSYS and segfaulting on that call. It's probably just some alignment issues or something. The weirdest part is if I use clang to compile C code that calls sigaction exactly the same way stack_overflow.rs does, it generates the correct code to execute the sigaction syscall. So that makes me think that the problem isn't with LLVM. Once I can figure that out, I'm pretty sure I'll be able to build snapshots for NetBSD and set up a build bot for that OS too. |
@dhuseby if you use |
@semarie wow, those bugs are nasty. I'm just trying to figure out why I'm getting signal 13 trampoline code generated for a call to sigaction. I'll know more in a few days. |
It looks like the build is failing because the Perhaps, though the struct could be defined as: pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_code: ::c_int,
pub si_errno: ::c_int,
#[cfg(target_pointer_width = "64")]
__pad1: ::c_int,
pub __pad: [u64; 13],
} That should mirror what we do in Linux which is to not give you This'll require more support code in std but it's a little more faithful to the representation on the system I think. |
@alexcrichton I just removed the #[cfg] for now since we don't support 32-bit netbsd anyways. |
rebased |
@@ -116,7 +116,8 @@ s! { | |||
pub si_code: ::c_int, | |||
pub si_errno: ::c_int, | |||
__pad1: ::c_int, | |||
__pad2: [u64; 14], | |||
si_addr: *mut ::c_void, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably wants to be pub
to be accessible from other crates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, I was tired and making dumb mistakes I guess :)
Could you also squash the commits down into one as well? |
@alexcrichton squashed and fixed. |
this fixes the siginfo_t compilation errors
@dhuseby Regarding the ENOSYS errors: Just a wild guess, but some compatibility system calls on NetBSD are just not available on x86_64, since they have been deprecated long since before x86_64 even existed. So you need to make sure not use the compatibility functions (most of them are really, really old). The libc crate used to define the I think the reason your code works in C, but not in Rust, is that NetBSD C header files defines alternative linker symbols for the replacements. If you call Unfortunately I've been too busy in the last few months to maintain Rusts NetBSD port myself. I have some time now, so let me know if I can help out. |
@gandro it was a #[link_name] problem. I have a patch inbound. |
@alexcrichton this fixes the siginfo_t problem with netbsd.