[PATCH 00/20] Create and use hidden aliases in libgmp.so

Niels Möller nisse at lysator.liu.se
Mon Mar 4 21:16:52 CET 2013

Richard Henderson <rth at twiddle.net> writes:

> Although I'm frankly a bit confused as to why we're using
> m4 for the assembly macro-isation, as opposed to the C preprocessor.

Different taste, I guess. I don't know why GMP moved to m4, but
personally, I wouldn't use cpp for anything that isn't C code, it's too
deeply tied to the notion of a C token.

And I think the additional power of m4 is used in gmp in a couple of
places, e.g., ifelse tests applied to macro arguments, and macros
expanding to macro definitions. And I don't think the macrology would
get much prettier with cpp-style token pasting...

> In particular, when -g is passed through from gcc to gas, gas sees and
> records the # file line markers that the preprocessor leaves, and puts
> that into the auto-generated line number debugging info.  With our m4
> scheme we get no such # markers and instead gas records line number
> info assocated with a no longer extant temp file.

The non-existant temp file definately is annoying, you have to comment
out a rm command in the m4-ccas script when debugging gmp assembly

As for #line markers, you can get them with m4 -s (not sure if it's a
GNUism or traditional m4). But when using non-trivial M4 macros, I find
it's often more helpful to have gdb guide you in the .s file after macro


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-devel mailing list