Hi, as part of my bootstrapping project that I have already mentioned a few emails ago, I would like to be able to compile Linux with tcc, trying to patch Linux as little as possible. Currently Linux uses the .macro syntax for the gas assembler, that I would therefore like to implement in tcc. The .macro directive implements another layer of macro substitution, not much different from the usual C preprocessor macro, except that the syntax is different (in particular, has allows named parameters and default values) and, of course, they are processed at different levels.
Trying to implement .macro has led me to a few questions for more seasoned tcc hackers. 1. During tcc execution, it seems that some of the state is kept in struct TCCState, while the rest is kept in global variables. I guess that is due to fact that originally everything was global, then at some point TCCState was introduced, but not everything has already been migrated there. Is this correct? In particular, I suppose that all new state should go into TCCState, not into other globals. 2. C preprocessor macros are kept in the table_ident global array and manipulated with define_push and similar functions. Each of them has a type that can be MACRO_OBJ or MACRO_FUNC. I am undecided whether gas macros should be implemented as an additional macro type (e.g., MACRO_GAS) and kept in the same array, or a new array should be created for them. The pro in the first case is that helper functions (like define_push and similar) are already there; however that would mean that the C preprocessor code must be modified so that it does not get confused by the appearance of a third macro type. What do you think about that? Thanks and all the best, Giovanni. -- Giovanni Mascellani <[email protected]> Postdoc researcher - Université Libre de Bruxelles
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
