|
eCos depends heavily on a number of language extensions provided by
the gcc and g++ compilers. In fact a number of these extensions were
added to these compilers specifically to support eCos (although they
have wider applications as well). The first such extension is C++
constructor priority ordering. When you define several C++ static
objects the language does not define the order in which these objects
get constructed. g++ now allows static objects to be ordered using the
__attribute__ mechanism, so for example it is possible to
create a scheduler object before any thread objects. The second
extension is selective linking. Traditionally linkers worked in terms
of compilation units, in other words entire files: if an application
needed a particular function from a library then all other library
functions which happened to be in the same source file would become
part of the application's executable. Instead the linker will now work
at the finer granularity of individual functions or variables.
Other extensions provided by gcc and g++ are used wherever
appropriate. For example attributes are used to define some functions
with weak linkage and to provide aliases for some functions. Inline
assembler is used to establish memory barriers and prevent the
compiler from optimizing in places where this would be undesirable,
for example in context switch code. Computed goto's may be used during
exception handling.
The use of these extensions makes it very difficult to use compilers
other than gcc and g++ to build eCos. In addition it is possible that
other extensions will be used in future if they prove to be
appropriate for the problem at hand. Therefore we recommend against
attempting to use any other compiler technology for eCos development.
|