Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Tiniest of nits to pick but:

> and I wish rustc would have a stand-alone assembly files support

Rustc now supports inline assembly and global assembly in Rust 1.59 (the very latest release). So this is now possible:

    /// Lib.rs file
    global_asm!(include_str!("asmfile.s"), options(raw));
Which will cause asmfile.s to be assembled and included in the rust library.


Absolutely, and any time you can use the built-in asm support, I'd recommend using it.

But also, I'd love to see support for C and assembly files in rustc.


Note that a really common use case for assembly files (.S files) is to expect that the file be transformed with the C preprocessor.

It would be interesting to imagine a replacement with a rust equivalent but I can't help thinking that it's difficult or impossible to come up with an architecture / exec format independent replacement (other than m4). gas and cc1as support .macro directives - maybe that would suffice? But compatibility with existing assembly source files would suffer.


You could have a build.rs script preprocess them with the C preprocessor if you really wanted. Or write a proc macro implementing a limited C preprocessor... ugh


Only for poor souls that never discovered macro assemblers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: