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

More testing #247

Closed
13 of 15 tasks
bjorn3 opened this issue Dec 26, 2018 · 20 comments
Closed
13 of 15 tasks

More testing #247

bjorn3 opened this issue Dec 26, 2018 · 20 comments
Labels
A-testing Area: Testing of cg_clif itself C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@bjorn3
Copy link
Member

bjorn3 commented Dec 26, 2018

@bjorn3 bjorn3 added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Dec 26, 2018
@bjorn3 bjorn3 self-assigned this Dec 26, 2018
@bjorn3 bjorn3 added this to the MVP milestone Jul 28, 2019
@bjorn3
Copy link
Member Author

bjorn3 commented Aug 20, 2019

Does anybody know of a rust program which doesn't use threads? I want to test compiling it using cg_clif.

@bjorn3 bjorn3 added the help wanted Extra attention is needed label Aug 20, 2019
@memoryruins
Copy link

(on mobile and unable to confirm if all of these don't use threads)

@bjorn3
Copy link
Member Author

bjorn3 commented Aug 20, 2019

Thanks @memoryruins! Will try them.

@bjorn3
Copy link
Member Author

bjorn3 commented Aug 21, 2019

@memoryruins Got all but the thread requiring programs working 🎉

@jyn514
Copy link
Member

jyn514 commented Oct 6, 2019

https://crates.io/crates/c2-chacha doesn't compile (used in rand): error: at fn core::core_arch[0]::x86_64[0]::sse41[0]::_mm_insert_epi64[0]: unsupported intrinsic simd_insert

I also got warning: err opening clif file: Os { code: 36, kind: Other, message: "File name too long" }, not sure if that affects the build.

Everything else for https://github.com/jyn514/rcc works well, great work!

@jyn514
Copy link
Member

jyn514 commented Oct 6, 2019

Other misc projects:

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `2816`,
 right: `0`: faerie doesn't support addends in data section relocations yet', /home/joshua/.cargo/git/checkouts/cranelift-af8713b52459e6cd/01201b1/cranelift-faerie/src/backend.rs:245:13

Edit(@bjorn3): working as of 83f6ef1

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 7, 2019

Thanks for testing.

https://crates.io/crates/c2-chacha doesn't compile (used in rand): error: at fn core::core_arch[0]::x86_64[0]::sse41[0]::_mm_insert_epi64[0]: unsupported intrinsic simd_insert

That is https://github.com/bjorn3/rustc_codegen_cranelift/issues/669. You can edit the Cargo.toml of c2-chacha to not passthrough the simd feature to one of its dependencies as workaround.

I also got warning: err opening clif file: Os { code: 36, kind: Other, message: "File name too long" }, not sure if that affects the build.

No it doesnt. In debug mode cg_clif tries to write the clif ir of every compiled function to target/out/clif in the source dir for cg_clif. If the filename is too big, it just ignores it. You can build cg_clif in release mode to prevent writing of clif ir. That also makes it a lot faster. You will need to set the CHANNEL env var to release for cargo.sh to use the release build.

https://github.com/hsivonen/encoding_rs (used in reqwest)

Known issue. faerie (the object file writer) doesnt implement something.

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 9, 2019

@jyn514
Copy link
Member

jyn514 commented Oct 9, 2019

bingrep works on my machine, not sure what error it's giving on yours.

$ uname -a
Linux joshua-ThinkPad 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 9, 2019

I hadnt tested any of them yet. Thanks for testing bingrep though.

@jyn514
Copy link
Member

jyn514 commented Oct 9, 2019

ripgrep fails with the same faerie error about addends in relocations. bgrep gives a whole bunch of 'undefined reference' errors at link time:

Compiling bgrep v1.0.0
[codegen mono items] start
[codegen mono items] end time: 6.034330509s
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/joshua/src/rust/rustc_codegen_cranelift/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/cargo-installgCjZJh/x86_64-unknown-linux-gnu/release/deps/bgrep-95e1d2faa1ae6220.some_file.o.rcgu.o" "-o" "/tmp/cargo-installgCjZJh/x86_64-unknown-linux-gnu/release/deps/bgrep-95e1d2faa1ae6220" "/tmp/cargo-installgCjZJh/x86_64-unknown-linux-gnu/release/deps/bgrep-95e1d2faa1ae6220.allocator_shim.o.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-installgCjZJh/x86_64-unknown-linux-gnu/release/deps" "-L" "/tmp/cargo-installgCjZJh/release/deps" "-L" "/home/joshua/src/rust/rustc_codegen_cranelift/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/tmp/rustcwOjofE/libbacktrace_sys-6dbde68fbe8a4381.rlib" "-Wl,--end-group" "/home/joshua/Documents/Programming/rust/rustc_codegen_cranelift/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-247a06f7027ddb1d.rlib" "-Wl,-Bdynamic" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /usr/local/bin/ld: /tmp/cargo-installgCjZJh/x86_64-unknown-linux-gnu/release/deps/bgrep-95e1d2faa1ae6220.some_file.o.rcgu.o: in function `core::option::Option<T>::unwrap':
          /home/joshua/Documents/Programming/rust/rustc_codegen_cranelift/build_sysroot/sysroot_src/src/libcore/macros.rs:12: undefined reference to `core::panicking::panic'
... truncated ...
/usr/local/bin/ld: /tmp/cargo-installgCjZJh/x86_64-unknown-linux-gnu/release/deps/bgrep-95e1d2faa1ae6220.allocator_shim.o.rcgu.o: in function `__rust_alloc_zeroed':
          allocator_shim.o:(.text.__rust_alloc_zeroed+0x6): undefined reference to `__rdl_alloc_zeroed'
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: failed to compile `bgrep v1.0.0`, intermediate artifacts can be found at `/tmp/cargo-installgCjZJh

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 9, 2019

I can't reproduce the bgrep link error. It compiles and runs fine for me with rustc 1.40.0-nightly (2748a9fd9 2019-10-08):

$ ../cargo.sh run -- -b bgrep target/x86_64-unknown-linux-gnu/debug/bgrep
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target/x86_64-unknown-linux-gnu/debug/bgrep -ob bgrep target/x86_64-unknown-linux-gnu/debug/bgrep -h`
0x632be3
0x632c0d
0x632c7b
0x632ca5
[...]

@jyn514
Copy link
Member

jyn514 commented Oct 9, 2019

Not sure what the issue is, it happens every time for me. I even tried rebuilding rustc_codegen_cranelift in release mode. Strange that it's only bgrep and not anything else.

I'm running ./cargo.sh install bgrep.

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 9, 2019

I am able to reproduce it by building bgrep in release mode. I will see if I can fix it.

For now you could use ./cargo.sh install --debug bgrep. cg_clif doesn't perform any extra optimizations in release mode anyway to workaround https://github.com/CraneStation/cranelift/issues/732.

@jyn514
Copy link
Member

jyn514 commented Oct 9, 2019

Yup installing in debug mode made it work.

@bjorn3
Copy link
Member Author

bjorn3 commented Oct 9, 2019

@bjorn3
Copy link
Member Author

bjorn3 commented Jan 18, 2020

@bjorn3
Copy link
Member Author

bjorn3 commented Feb 26, 2020

Pretty much all applications mentioned here now work. Only zemeroth doesn't work yet, because of some trouble with c2-chacha patching.

@bjorn3 bjorn3 removed this from the MVP milestone Jul 17, 2020
@bjorn3 bjorn3 removed their assignment Mar 6, 2021
@bjorn3 bjorn3 added the A-testing Area: Testing of cg_clif itself label Mar 31, 2021
@bjorn3 bjorn3 removed the help wanted Extra attention is needed label May 10, 2021
@bjorn3
Copy link
Member Author

bjorn3 commented Dec 29, 2021

Going to close this as I don't think I have seen a misconpilation in quite a while. Pretty much all programs cg_clif can't compile right now are due to missing features rather than bugs in cg_clif. If anyone finds a program cg_clif can't handle please do report it as a new issue.

@bjorn3 bjorn3 closed this as completed Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testing Area: Testing of cg_clif itself C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

3 participants