Inline assembly in GCC [linux-insides]

Posted on 2016/05/02


The news site lwn just posted a guide on GCC inline assembly. The guide is written in plain colloquial language and is a great complement to GCC documentation on the matter, which is more of a reference of the various functionalities. I found that the extended form of inline assembly is a powerful way to use the machine special capabilities in C, but every line needs the correct inputs, outputs and flags. If they are not chosen correctly, the compiler could produce something that doesn’t work as you would expect, and this could happen silently and only with some combination of optimization options, function complexity and context.

Posted in: Embedded