GNU as an extension to the macro directive

Is there a way to use GNU only to extend the .macro directives in a .S file by creating another .S file without them? Compatible with what gcc -E does with C.

Note that this applies to the asmacro.macro directive, as in the following code, not to the C-style #define macros, which can be extended with cpp.

.macro my_macro src, so, dest movl \so+10(\src), %r8d 
+8
assembly macros
source share
2 answers

GNU, as a preprocessor, does not process .include and .macro , since everything starting from a point is actually an assembler directive; thus, macrodistribution is performed by program assembly and cannot be performed separately, at least by.

You have the following options:

  • Search google for someone else script
  • Write your own (seems good programming)
  • Switch to C or M4 style macros

C-style macro processing is performed by default when you use the .S (capital s) extension for assembly files that you use to supply gas, and the C preprocessor can also be called autonomously using the cpp command

+2
source share

Perhaps you could use ' cpp ' to evaluate macros:

> cpp -P file.S

or collect after macro expansion:

> cpp -P file.S | as -o file.o

0
source share

All Articles