On Thu, Jul 17, 2025 at 01:02:21 +0530, Mohan wrote:

> is it common to use m4 with gas?

There are not much code written in assembler these days and the little
amount that gets written probably can get by with the C preprocessor
and or gas own macro facility.  Also my impression is that
macro-processors are not really in any more (they are kinda...
forgotten, I guess).  So I don't expect m4 to be in common use either
specifically for assembler programming or in general.

But I still love m4 :).  Tiny, powerful, versatile - comes in handy
when you need it.  Recently I used it to generate intrinsics for
the Potable CLU compiler, e.g.:

  https://github.com/nbuwe/pclu/blob/default/code/sysasm/Opt/oneof_pfx.m4


> are there examples i can learn from or just general resources for
> unix asm programming?

Some 30 years ago I've got a QIC tape with a bunch of what we now call
"open-source" software on it.  Included among other things was MIT
Scheme (I don't remember the version, whatever it was in the early
90s).  It had quite a bit of m4+asm code.  The problem was that the
m68k systems we had at the time used one assembler syntax and MIT
Scheme was written in another (think Intel vs ATT syntax for x86).
But since it was written in m4+asm it was not really that much
_source_ code to edit and then m4 took care of the rest and quite soon
I was welcomed with "Moriturus te saluto".

sendmail.cf was also (in)famously written in m4.

Not m4, but both troff and TeX are (custom) macroprocessors.

-uwe

Reply via email to