-
Notifications
You must be signed in to change notification settings - Fork 13.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
LLVM ERROR: Invalid LLVMRustLinkage value! #87813
Comments
Forgive the unsafe mess :) |
Using a self built rustc, I get this (already
I also got this recently:
|
I managed to recude the code a lot. I'm not sure why or what, but when running it ten times ( #![feature(once_cell)]
pub mod addr {
use std::convert::TryFrom;
use std::marker::PhantomData as PD;
extern "C" {
pub static _ENARX_SALLYPORT_START: u8;
}
pub struct Address<T, U>(T, PD<U>);
impl<T, U> Address<T, U> {
pub fn f<Z>(_: &Z) -> Self {
todo!()
}
}
pub struct ShimVirtAddr<U>(Address<u64, U>);
impl<U> TryFrom<Address<u64, U>> for ShimVirtAddr<U> {
type Error = ();
fn try_from(_: Address<u64, U>) -> Result<Self, Self::Error> {
Err(())
}
}
pub struct ShimPhysUnencryptedAddr<U>(Address<u64, U>);
impl<U> ShimPhysUnencryptedAddr<U> {
pub fn into_mut<'a>(self) -> &'a mut U {
unsafe { &mut *(self.0 .0 as *mut U) }
}
}
impl<U> TryFrom<ShimVirtAddr<U>> for ShimPhysUnencryptedAddr<U> {
type Error = ();
#[inline(always)]
fn try_from(_: ShimVirtAddr<U>) -> Result<Self, Self::Error> {
let _a = 0 < unsafe { &_ENARX_SALLYPORT_START as *const _ as u64 };
Err(())
}
}
}
pub mod hostcall {
extern "C" {
pub static _ENARX_SALLYPORT_START: Block;
}
use std::convert::TryFrom;
use std::lazy::SyncLazy;
use crate::addr::{Address, ShimPhysUnencryptedAddr, ShimVirtAddr};
#[repr(C)]
#[derive(Copy, Clone)]
pub struct Block {
buf: [u8; 100],
}
pub static HOST_CALL_ALLOC: SyncLazy<HostCallAllocator> = SyncLazy::new(|| {
let _a: *mut Block = unsafe {
let address = Address::<u64, Block>::f(&_ENARX_SALLYPORT_START);
let shim_virt = ShimVirtAddr::<Block>::try_from(address).unwrap();
ShimPhysUnencryptedAddr::<Block>::try_from(shim_virt)
.unwrap()
.into_mut() as *mut _
};
HostCallAllocator([None, None])
});
pub struct HostCallAllocator([Option<&'static mut Block>; 2]);
}
fn main() {} @jonas-schievink would you mind pinging the LLVM crew? I don't know what to do here :( |
With a custom built llvm (and asserts on) I will now get this error every time 🎉
|
@rustbot ping llvm |
Hey LLVM ICE-breakers! This bug has been identified as a good cc @camelid @comex @cuviper @DutchGhost @hdhoang @henryboisdequin @heyrutvik @higuoxing @JOE1994 @jryans @mmilenko @nagisa @nikic @Noah-Kennedy @SiavoshZarrasvand @spastorino @vertexclique |
So, I got this: #[inline(always)]
fn other_ext() {
extern "C" {
pub static _ENARX_SALLYPORT_START: u8;
}
unsafe { drop(&_ENARX_SALLYPORT_START) };
}
#[inline(always)]
fn this_ext() {
extern "C" {
pub static _ENARX_SALLYPORT_START: u16;
}
unsafe { drop(&_ENARX_SALLYPORT_START) };
}
fn main() {
this_ext();
other_ext();
} The key is to have two identical named extern variables with a different type. They have be called and inlined for this to work. I'm not sure if bisecting here is helpful because it will probably bisect to the LLVM12 merge. But the LLVM people here on the repo should be able to find something :) Have fun |
Still spurious.
|
Yes and no.
So the key here is to have a LLVM backend with asserts enabled. |
Assigning priority based on the discussion for #87933 in the Zulip thread of the Prioritization Working Group. @rustbot label +regression-from-stable-to-stable +P-high |
Still an issue even with the LLVM13 upgrade :/ |
Valgrind gave me a little more clue where this is coming from for #91050. |
seems to be fixed.. thank you! |
this is necessary to make the testsuite pass; otherwise, curl and libxml hit rust-lang/rust#87813 now that we translate their inline asm (which only appears from transitive includes on ubuntu 18.04)
this is necessary to make the testsuite pass; otherwise, curl and libxml hit rust-lang/rust#87813 now that we translate their inline asm (which only appears from transitive includes on ubuntu 18.04)
this is necessary to make the testsuite pass; otherwise, curl and libxml hit rust-lang/rust#87813 now that we translate their inline asm (which only appears from transitive includes on ubuntu 18.04)
this is necessary to make the testsuite pass; otherwise, curl and libxml hit rust-lang/rust#87813 now that we translate their inline asm (which only appears from transitive includes on ubuntu 18.04)
Code
https://github.com/haraldh/rust_llvm_error
Meta
rustc --version --verbose
:Error output
The text was updated successfully, but these errors were encountered: