Merge branch 'master' into sync_from_rust_2025_04_25_2

This commit is contained in:
Antoni Boucher 2025-04-25 10:05:03 -04:00
commit 5dbe271045
2 changed files with 30 additions and 0 deletions

24
src/archive.rs Normal file
View file

@ -0,0 +1,24 @@
use std::path::Path;
use rustc_codegen_ssa::back::archive::{
ArArchiveBuilder, ArchiveBuilder, ArchiveBuilderBuilder, DEFAULT_OBJECT_READER,
};
use rustc_session::Session;
pub(crate) struct ArArchiveBuilderBuilder;
impl ArchiveBuilderBuilder for ArArchiveBuilderBuilder {
fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box<dyn ArchiveBuilder + 'a> {
Box::new(ArArchiveBuilder::new(sess, &DEFAULT_OBJECT_READER))
}
fn create_dll_import_lib(
&self,
_sess: &Session,
_lib_name: &str,
_import_name_and_ordinal_vector: Vec<(String, Option<u16>)>,
_output_path: &Path,
) {
unimplemented!("creating dll imports is not yet supported");
}
}

View file

@ -21,6 +21,8 @@ fn int_cast(a: u16, b: i16) -> (u8, u16, u32, usize, i8, i16, i32, isize, u8, u3
)
}
static mut ONE: usize = 1;
#[no_mangle]
extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 {
let (a, b, c, d, e, f, g, h, i, j) = int_cast(10, 42);
@ -28,6 +30,10 @@ extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 {
libc::printf(b"%d\n\0" as *const u8 as *const i8, c);
libc::printf(b"%ld\n\0" as *const u8 as *const i8, d);
libc::printf(b"%ld\n\0" as *const u8 as *const i8, j);
let ptr = ONE as *mut usize;
let value = ptr as usize;
libc::printf(b"%ld\n\0" as *const u8 as *const i8, value);
}
0
}