Use of constraints when mapping C variables to ASM symbolic names?

Andrew Haley aph@redhat.com
Mon Aug 24 08:46:00 GMT 2015


On 21/08/15 16:38, Jeffrey Walton wrote:
> I was done in under 15 minutes on that inferior compiler. That was
> write the code, compile the code, verify code generation by examining
> listing and verifying the code under the debugger with a live target.
> Under GCC, I'm into my second day because I can't directly use a C
> variable from an ASM block, and I can't seem to accurately express my
> intentions with the multi-line extended ASM.

I can't immediately see why you can't use a named operand to access
a C variable.

I suspect your difficulty is due to a lack of experience with GCC.
Rather than ask "How can I make GCC do it this way?" you might be
better to ask "What is the best way to solve this problem by using
GCC?"  GCC's extended asm is the way it is for reasons to do with
getting the best performance and minimizing the amount of hand-written
assembly language you need.  Yes, it takes some getting used to and
can be obscure.

Andrew.



More information about the Gcc-help mailing list