Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GNU assembler preprocessor define

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.

like image 602
user5491654 Avatar asked Oct 27 '15 02:10

user5491654


1 Answers

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).

like image 82
fuujuhi Avatar answered Oct 11 '22 10:10

fuujuhi