Stream: project-inline-asm

Topic: Next steps for the group

Amanieu (May 14 2020 at 14:20, on Zulip):

The inline assembly RFC has a list of future possibilities for features to add to inline assembly.

Amanieu (May 14 2020 at 14:20, on Zulip):

I personally feel that these two are the most promising:

Amanieu (May 14 2020 at 14:27, on Zulip):

I'm particularly interested in bringing global_asm! up to speed with the new features of asm!. As a bonus, this would allow us to deprecate the existing naked function support and replace it with a proc macro.

Amanieu (May 14 2020 at 14:28, on Zulip):

The clobber support feels important since it fills in a usability hole with asm!: you can't reliably mark all registers as clobbered if the ISA can add new registers in the future.

Josh Triplett (May 14 2020 at 17:46, on Zulip):

So, a "clobber all registers that a function call is considered to clobber on the native ABI" clobber?

Josh Triplett (May 14 2020 at 17:46, on Zulip):

That seems like a great idea to me.

Josh Triplett (May 14 2020 at 17:47, on Zulip):

I personally am excited about having a structured, if-like or match-like construct that can effectively replace asm goto.

Amanieu (May 14 2020 at 17:51, on Zulip):

I'm less excited about asm goto since it is likely to be very difficult to implement and it doesn't really enable any new use cases like the two features I mentioned above: you can always emulate asm goto by returning an int and matching on that.

Josh Triplett (May 14 2020 at 18:00, on Zulip):

It does enable a specific new use case: static branches that use unconditional jumps and are binary-patchable.

Josh Triplett (May 14 2020 at 18:01, on Zulip):

The Linux kernel uses many of those, for performance-sensitive code.

Josh Triplett (May 14 2020 at 18:01, on Zulip):

The goal is to completely eliminate the conditional.

Lokathor (May 14 2020 at 21:23, on Zulip):

When global_asm gets worked on, I hope that we can give it the link_section attribute (I don't know if that's already possible). This would allow me to pull my project's equivalent for the "crt0.s" entirely inside of rust and then I'd only need to do a little linker script magic, wouldn't need to directly call the assembler (from at all.

Amanieu (May 14 2020 at 22:09, on Zulip):

There won't be any attributes on global_asm! itself but you can use assembler directives inside it.

Amanieu (May 14 2020 at 22:10, on Zulip):

Essentially you would do global_asm!(include_str!("crt0.s"))

Amanieu (May 14 2020 at 22:10, on Zulip):

In fact, you can already do that today.

Amanieu (May 14 2020 at 22:12, on Zulip):

The only changes I want to make to global_asm are:

Josh Triplett (May 14 2020 at 22:31, on Zulip):

I'm assuming it'll support the att_syntax option?

Josh Triplett (May 14 2020 at 22:33, on Zulip):

Looking over the entire asm! RFC again, I don't see anything else that would need changing in global_asm!, yeah.

Last update: Jun 05 2020 at 23:10UTC