Re: Inline asm (x86): How to use offsettable addresses?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Frank Heckenbach <f.heckenbach@xxxxxxxxxx> writes:

>> If you want to add an offset, then you should either do it in the value
>> passed to the asm,
>
> When possble that's easier, of course. In my case, however, I need
> different (constant) offsets within the asm block.

Pass each constant offset you need as a different operand to the asm.


>> The 'o'
>> constraint tells gcc that it can use a small offset in the address that
>> it passes into the asm.
>
> Alright. But I thought (and still think ;-) that if gcc can add a
> small offset, I should be able to add another one, since the sum of
> two small offsets is still a small offset. (And it almost works,
> except for this little syntactic issue whether or not to put a "+".)

Let me put it this way, then; the 'o' constraint is designed for gcc
internal use.  It is not designed for the use to which you want to put
it.  What you are looking for is reasonable, but the 'o' constraint does
not provide it.


> So I suppose, I'll keep my current work-around ("forcing" an offset
> and always using "+") until it breaks. At least, it will give a
> compile-time error when it fails, and not silently produce wrong
> code. (At least I don't see a way how it could result it wrong code,
> or do you?)

I think it should always either work or give an assembly-time error,
yes.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux