Porting to .intel_syntax Inline Assembly / "m" Constraint with .intel_syntax / Targeting -fPIC
Ian Lance Taylor
iant@google.com
Wed Mar 5 00:37:00 GMT 2008
Daniel Yek <dyek@real.com> writes:
> I would like to find out if it is a good idea to utilize GCC's
> .intel_syntax Inline Assembly support (for non-trivial blocks), or to
> convert them to GAS or NASM assembly functions, .S files.
For a complete function written in assembly code, you might as well
put it in a .s or .S file. You can put it in a .c file using a simple
asm if that is is more convenient for you. It doesn't make any big
difference.
> Is there a way I can use the memory constraint, "m", effectively in
> .intel_syntax Inline Assembly?
Use the -masm=intel option with gcc.
> (3) Is there any document providing information how I can create a
> single version of assembly code (Inline Assembly or pure assembly) and
> have it compiled with or without -fPIC correctly?
I don't know of any document. The basic guideline is fairly obvious:
don't use %ebx. If you must use it, push and pop it in your assembly
code.
Ian
More information about the Gcc-help
mailing list