[ECOS] compiler dependencies

Bart Veer bartv@cygnus.co.uk
Tue Dec 22 07:02:00 GMT 1998

>>>>> "Kenneth" == Kenneth Porter <kenneth_porter@kensingtonlabs.com> writes:

    >> eCos makes use of a number of very useful language extensions
    >> which are provided by gcc and g++ but not by other compilers,
    >> and there are no plans to support other compilers.

    Kenneth> Can you enumerate these in the FAQ? I see two listed,
    Kenneth> priority constructor ordering (required) and selective
    Kenneth> linking (optional).

I have now added a section to the FAQ related to this. Please see

    Kenneth> I've been using Borland's compiler for some time in the
    Kenneth> PC 16-bit world and in embedded system development and I
    Kenneth> know it supports a generalization of priority constructor
    Kenneth> ordering: One can use "#pragma startup" with a priority
    Kenneth> code to request that a function be executed during RTL
    Kenneth> init. The RTL uses this mechanism to order initialization
    Kenneth> of various RTL structures (heap, stdio, FPU emulator).
    Kenneth> The compiler uses the same internal structures to
    Kenneth> implement constructor calls for static objects.

#pragma is usually a poor choice for doing this sort of thing. The gcc
documentation includes the following in the description of

>   Some people object to the `__attribute__' feature, suggesting that
> ANSI C's `#pragma' should be used instead. There are two reasons for
> not doing this.
>  1. It is impossible to generate `#pragma' commands from a macro.
>  2. There is no telling what the same `#pragma' might mean in
>  another compiler.
>   These two reasons apply to almost any application that might be
> proposed for `#pragma'. It is basically a mistake to use `#pragma'
> for *anything*.

There is some work in progress in the ISO C standard world to come up
with something like #pragma but without these shortcomings. Until that
becomes widely available it is not possible to use #pragma safely in
portable code.

Bart Veer // eCos net maintainer

More information about the Ecos-discuss mailing list