Mail Archives: djgpp/2000/06/21/00:22:06
On Tue, 20 Jun 2000, Richard Dawe wrote:
> #if GAS_MAJOR >= 2 && GAS_MINOR > 8
> "nop \r\n"
> #endif /* IFDEFTEST */
> "nop \r\n");
I understand that this is just an example, because in the actual problem
you had you will need a different condition for the versions (e.g., if
GAS_MAJOR is 3 or more, GAS_MINOR is not important).
> Is this
> satisfactory? My sed knowledge is limited (*), but this seems to do the
> trick.
The Sed scripts can be improved slightly, but they seem to be correct.
> It took me a while to work out how to put #ifdefs in inline assembly. Eli,
> you probably knew this already, but: You have to rely on C's string
> concatenation.
For inline assembly, you need to rely on the preprocessor to do the
trick when it works on the C source, so the #ifdef's need to be on the C
level, not on the assembly level.
> [ If you put '#ifdef' in the inline assembly, then it becomes an assembly
> comment and does nothing.
AFAIK, inline assembly doesn't go through cpp; GCC emits it in the
form of preprocessed assembly. So you cannot have any preprocessor
directives inside the asm() block.
> This feels like less of a hack than relying on gas to generate the right
> code in spite of a warning.
More importantly, it's safer ;-)
- Raw text -