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

wasi-sdk/bin/wasm-ld regression in 1.46.0 #76679

Open
TjeuKayim opened this issue Sep 13, 2020 · 4 comments
Open

wasi-sdk/bin/wasm-ld regression in 1.46.0 #76679

TjeuKayim opened this issue Sep 13, 2020 · 4 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc O-wasm Target: WASM (WebAssembly), http://webassembly.org/ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@TjeuKayim
Copy link

I tried to cross compile a hello world with WASI SDK as explained at https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/wasm32_wasi/index.html:

cargo init
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/wasi-sdk_11.0_amd64_ubuntu20.04.deb
sudo dpkg -i wasi-sdk_11.0_amd64_ubuntu20.04.deb
rm wasi-sdk_11.0_amd64_ubuntu20.04.deb
export CC_wasm32_wasi=/opt/wasi-sdk/bin/clang
export CARGO_TARGET_WASM32_WASI_LINKER=/opt/wasi-sdk/bin/clang
cargo build --target wasm32-wasi

I expected to see this happen: the build succeeds with Rust v1.45.2 , so next versions should be compatible.

Instead, this happened when updating to Rust v1.46.0: https://github.com/TjeuKayim/wasi-link-fail/runs/1109104907

error: linking with `/opt/wasi-sdk/bin/clang` failed: exit code: 1
##[error]  |
  = note: wasm-ld: error: unknown argument: --eh-frame-hdr
          clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

And 1.48.0-nightly (2020-09-12) produces another error: https://github.com/TjeuKayim/wasi-link-fail/runs/1109104926

error: linking with `/opt/wasi-sdk/bin/clang` failed: exit code: 1
##[error]  |
  = note: wasm-ld: error: std-5fceb8daecdd3ed8.std.5ro3oaeh-cgu.0.rcgu.o: Bad relocation type: 
          clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

A weird exception is my Manjaro Linux system with Rust 1.46.0, it only builds succesfully when I add RUSTFLAGS='-C link-args=-Wl,-v'. I have no clue why, and couldn't reproduce this on Ubuntu.

See this repository for a minimal reproduction https://github.com/TjeuKayim/wasi-link-fail.

@TjeuKayim TjeuKayim added the C-bug Category: This is a bug. label Sep 13, 2020
@Dylan-DPC-zz Dylan-DPC-zz added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 14, 2020
@mati865
Copy link
Contributor

mati865 commented Sep 14, 2020

--eh-frame-hdr was recently fixed on nightly: #76307

@LeSeulArtichaut LeSeulArtichaut added A-linkage Area: linking into static, shared libraries and binaries regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Sep 16, 2020
@LeSeulArtichaut
Copy link
Contributor

@TjeuKayim is your issue fixed on the latest nightly?

@TjeuKayim
Copy link
Author

TjeuKayim commented Sep 16, 2020

is your issue fixed on the latest nightly?

No, rust version 1.48.0-nightly (6af1bdda5 2020-09-15) is still affected.
I ran the Github Action again https://github.com/TjeuKayim/wasi-link-fail/runs/1122804715, the same error appeared:

  = note: wasm-ld: error: std-5fceb8daecdd3ed8.std.5ro3oaeh-cgu.0.rcgu.o: Bad relocation type: 
          clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

@LeSeulArtichaut LeSeulArtichaut added O-wasm Target: WASM (WebAssembly), http://webassembly.org/ E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example and removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Sep 16, 2020
@TjeuKayim
Copy link
Author

The bisection below seems to point to the introduction of the other eh-frame-hr regression, that's useless. To bisect the other regression that causes this issue, it needs to apply the #76307 patch on rustc before testing, but I don't now how to execute such bisection.

searched nightlies: from nightly-2020-06-30 to nightly-2020-07-30
regressed nightly: nightly-2020-07-03
searched commits: from f781bab to 3503f56
regressed commit: 8a6d434

bisected with cargo-bisect-rustc v0.5.2

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start=2020-06-30 --end=2020-07-30 --target wasm32-wasi -- build --target wasm32-wasi

@spastorino spastorino added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 16, 2020
trickypr added a commit to pulse-browser/browser that referenced this issue Dec 28, 2021
This is based on the existance of rust-lang/rust#76679 and has no evidence that this will fix anything
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc O-wasm Target: WASM (WebAssembly), http://webassembly.org/ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants