tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Implementing .macro gas syntax


From: Giovanni Mascellani
Subject: [Tinycc-devel] Implementing .macro gas syntax
Date: Sat, 26 Jan 2019 19:10:27 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

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 <address@hidden>
Postdoc researcher - Université Libre de Bruxelles

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]