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

Fail to build compiler-builtins for target x86_64-pc-windows-gnu #41630

Closed
malbarbo opened this issue Apr 29, 2017 · 6 comments
Closed

Fail to build compiler-builtins for target x86_64-pc-windows-gnu #41630

malbarbo opened this issue Apr 29, 2017 · 6 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@malbarbo
Copy link
Contributor

> git clone https://github.com/rust-lang-nursery/compiler-builtins
> compiler-builtins

Works with nightly-2017-04-25 (llvm 3.9)

> rustup toolchain install nightly-2017-04-25
> rustup target add --toolchain nightly-2017-04-25 x86_64-pc-windows-gnu
> rustc +nightly-2017-04-25 -v --version
rustc 1.18.0-nightly (63c77214c 2017-04-24)
binary: rustc
commit-hash: 63c77214c1d38789652b465694b254205d1886e0
commit-date: 2017-04-24
host: x86_64-unknown-linux-gnu
release: 1.18.0-nightly
LLVM version: 3.9
> cargo +nightly-2017-04-25 build --target x86_64-pc-windows-gnu
   Compiling compiler_builtins v0.1.0 (file:///tmp/compiler-builtins)
    Finished dev [unoptimized + debuginfo] target(s) in 2.11 secs

Fails with nightly-2017-04-26 (llvm 4.0)

> rustup toolchain install nightly-2017-04-26
> rustup target add --toolchain nightly-2017-04-26 x86_64-pc-windows-gnu
> rustc +nightly-2017-04-26 -v --version
rustc 1.18.0-nightly (2b4c91158 2017-04-25)
binary: rustc
commit-hash: 2b4c911581099e247a68b3a8adc782d778f5190b
commit-date: 2017-04-25
host: x86_64-unknown-linux-gnu
release: 1.18.0-nightly
LLVM version: 4.0
> cargo +nightly-2017-04-26 build --target x86_64-pc-windows-gnu
   Compiling compiler_builtins v0.1.0 (file:///tmp/compiler-builtins)
rustc: /checkout/src/llvm/include/llvm/CodeGen/MachineFunction.h:452: bool llvm::MachineFunction::hasWinCFI() const: Assertion `HasWinCFI.hasValue() && "HasWinCFI not set yet!"' failed.
error: Could not compile `compiler_builtins`.
@malbarbo
Copy link
Contributor Author

malbarbo commented May 2, 2017

@TimNN Do you have some thought about this?

@TimNN
Copy link
Contributor

TimNN commented May 3, 2017

Sorry, I'm not really that much of a windows expert, although I can try and minify / reproduce if that also occurs when cross-compiling.

@malbarbo
Copy link
Contributor Author

malbarbo commented May 3, 2017

Thanks for your attention @TimNN. I'm cross compiling from a Linux machine. I minified the case. The problems seems to be with naked functions

#![feature(naked_functions)]

#[cfg(windows)]
#[naked]
pub unsafe fn f() {}

pub fn main() {}

Do you have any suggestion who to contact?

@TimNN
Copy link
Contributor

TimNN commented May 3, 2017

This affects 64bit MinGW and Msvc targets, here is a non-core repro:

#![feature(lang_items, naked_functions, no_core)]
#![crate_type = "lib"]
#![no_core]

#[lang = "sized"]
trait Sized {}

#[lang = "copy"]
trait Copy {}

#[naked]
unsafe fn _f() {}

I'l get try and get some minified IR.

Nominating since this breaks rust-lang-nursery.

@TimNN TimNN added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 3, 2017
@TimNN
Copy link
Contributor

TimNN commented May 3, 2017

IR:

target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"

define internal void @_ZN5naked2_f17h37d58925d66289bcE() naked {
start:
  ret void
}

Upstream bug: https://bugs.llvm.org/show_bug.cgi?id=32912

@TimNN
Copy link
Contributor

TimNN commented May 3, 2017

Potential patch: https://reviews.llvm.org/D32822

Edit: Another patch has been committed: llvm-mirror/llvm@6e53fe2

bors added a commit that referenced this issue May 4, 2017
Update llvm to pull in various backports

Fixes #41672
Fixes #41630
Fixes #41685
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. 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

2 participants