This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Compiling individual sources


>>>>> "Rafael" == Rafael =?iso-8859-1?Q?Rodr=EDguez?= Velilla <Rafael> writes:

    <snip>

    Rafael> It is a pity that gcc can't decide when does it need a
    Rafael> long-call and when not.

The compiler has no idea what code or data will end up where in
memory, that is the responsibility of the linker. Theoretically it
would be possible for the compiler to always issue a long call, and
then have the linker turn this into a short call if possible. Or have
the compiler always issue a short call, with the linker turning this
into a long call if necessary. However if the compiler does not know
exactly what instructions are going to end up in the final executable
then that is going to mess up any effort at optimisation. For example,
IIRC a long call requires an intermediate register so the compiler
would have to ensure that for every call operation there is a spare
register available. That is a big overhead for a problem that only
affects some code on some targets.

Arguably the underlying problem is that code generation is done by the
compiler rather than by the linker, and the former has insufficient
knowledge unless assisted by e.g. explicit attributes in the source
code. However this division of labour between compiler and linker is
not going to change any time soon.

Bart


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]