[llvm-dev] [inline-asm][asm-goto] Supporting "asm goto" in inline assembly

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 14 09:46:55 PST 2018


On Wed, Feb 14, 2018 at 2:34 AM, David Woodhouse <dwmw2 at infradead.org>
wrote:

> Let's not conflate the asm-goto part with the .pushsection/.popsection.
>
> The latter ("0: .pushsection foo; .long 0b; .popsection") is used *all*
> over the kernel to build up tables of code locations — for exception
> handling of instructions which might fault, as well as for runtime
> patching of instructions like the above. It's not always a nop vs. call
> alternative.
>
> It would be nice to have the compiler assist with that. We currently
> have code to trawl through all the built object files and find calls to
> __fentry__ so we can patch them in/out at runtime, for example. And we
> might considered doing the same for calls to the retpoline thunks.
>
> But I think we would be best served right now by considering that out
> of scope, and looking *only* at the part which is handled by 'asm
> goto'.
>

Collecting labels in code is a pretty interesting and reasonable use case.
I'd be really interested in a separate discussion or document describing
the kernel use cases for this. In particular, I'm worried about what things
LLVM might hoist across the label. We might want to end up designing
something more like real asynchronous exception handling (__try) than all
this assembly blob stuff.

But I agree, asm-goto is probably higher priority.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180214/85e69843/attachment.html>


More information about the llvm-dev mailing list