5
votes

I have two questions:

  1. How do I use CPP (C Preprocessor) with GNU's AS

  2. How do I use "continuation lines" (like some line \ next line)?

For the first, I know you can use .include instead of #include, but #define doesn't work (and I don't know the equivalent). File extension .S is supposed to force it to use the preprocessor, same with g++ -x assembler-with-cpp.

1
Welcome to SO! Please make a single question per post, and make your title very precise. I don't reproduce you with gcc in.S: preprocessor does get uesd in that case. - Ciro Santilli 新疆再教育营六四事件法轮功郝海东

1 Answers

5
votes

As indicated by @Ciro Santilli, GNU AS does not perform CPP-like preprocessing. For this you need to assemble your file with gcc, like gcc in.S. Doing so enables both the CPP preprocessor and the continuation line symbol.

Otherwise, the AS directive that is roughly equivalent to #define for GNU AS stand-alone is .set (to define new symbols, see AS manual).