Skip to content
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

Linking with cc gets a spurious return code on ARM #10191

Closed
chris-morgan opened this issue Oct 31, 2013 · 3 comments
Closed

Linking with cc gets a spurious return code on ARM #10191

chris-morgan opened this issue Oct 31, 2013 · 3 comments
Labels
O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state

Comments

@chris-morgan
Copy link
Member

Steps to reproduce:

  1. Take a build of rustc for ARM (specifically, gnueabi; gnueabihf is untested and may or may not exhibit this problem). Luqman has one you can use at http://luqman.ca/rust-builds/.
  2. Attempt to compile something, e.g. echo 'fn main(){}' | rustc -.

The binary is created successfully and will run fine (I finally have rust-http running on my Android-with-Ubuntu-inside-it tablet!), but the .o file remains around and rustc also dies with a spurious return code from the linker.

error: linking with `cc` failed with code 1081742352
note: cc arguments: -L/home/chris/opt/rust/lib/rustc/arm-unknown-linux-gnueabi/lib -marm -o /tmp/rust_out /tmp/rust_out.o -L/home/chris/opt/rust/lib/rustc/arm-unknown-linux-gnueabi/lib -lstd-6c65cf4b443341b1-0.9-pre -L/home/chris/opt/rust/lib/rustc/arm-unknown-linux-gnueabi/lib -lrustuv-d4277cd5f62aa99-0.9-pre -lrustrt -lrt -lpthread -L/tmp/.rust -L/tmp -lrt -ldl -lm -lmorestack -lrustrt -Wl,-rpath,$ORIGIN/../home/chris/opt/rust/lib/rustc/arm-unknown-linux-gnueabi/lib -Wl,-rpath,/home/chris/opt/rust/lib/rustc/arm-unknown-linux-gnueabi/lib -Wl,-rpath,/scratch/laden/local/lib/rustc/arm-unknown-linux-gnueabi/lib
note: 
error: aborting due to previous error
task '<unnamed>' failed at 'explicit failure', ../src/libsyntax/diagnostic.rs:101
task '<unnamed>' failed at 'explicit failure', ../src/librustc/rustc.r:396

(I typed that out by hand; it's possible that it may not be entirely correct.)

The claimed return code is well outside what I believe to be the valid range for return codes (I think it's supposed to be an unsigned 8-bit value) and is different each time. I presume that it's not retrieving the return value correctly. If one runs cc manually with the specified arguments, the return code is 0, as expected.

@miselin
Copy link
Contributor

miselin commented Oct 31, 2013

It could be worth doing a small testcase with a small C program + libuv on the same ARM target/host that spawns cc and peeks at the exit status reported. If libuv is reporting a weird exit status to the exit callback, without any of our Rust runtime doing anything funky, then this might be a libuv bug.

Otherwise, #10109 may resolve this once it lands, or at least make it clearer what the issue is.

@chris-morgan
Copy link
Member Author

Given this source:

use std::run::{Process, ProcessOptions};

fn main() {
    println!("{}", Process::new("echo", [~"foo"], ProcessOptions::new()).finish());
}

This returns 0 every time on my x86_64 machine, but on my ARM machine it returns values like 1080882192, 1081480208, 1081672720 and 1082012688.

I guess that narrows the problem down to std::rt::io::process getting the exit status wrong.

@chris-morgan
Copy link
Member Author

This bug no longer occurs.

flip1995 pushed a commit to flip1995/rust that referenced this issue Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state
Projects
None yet
Development

No branches or pull requests

2 participants