avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] How to link without .init4 ?


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] How to link without .init4 ?
Date: Mon, 22 Aug 2005 22:12:20 +0200 (MET DST)

Bernard Fouché <address@hidden> wrote:

> avr-gcc ... -nostartfiles

> with no luck: all the .init4 stuff is still there but I've lost the
> vector table at the beginning (__vectors).

There are two things to consider:

__do_clear_bss zeroes the .bss section, and is being dragged in from
libgcc.a.  You could simply supply your own null version of it in your
code I think.

There are two versions of __do_copy_data which is used to setup .data.
One also comes from libgcc.a, so you could supply your own instead.
However, there's a second version in some copies of the startup code,
the respective comment reads:

#if BIG_CODE
        /* Only for >64K devices with RAMPZ, replaces the default code
           provided by libgcc.S which is only linked in if necessary.  */

        .section .init4,"ax",@progbits
        .global __do_copy_data
__do_copy_data:
....

So for the ATmega103 and ATmega128, you'll always drag in that version
as part of the startup files. :-(

> Also .init4 is said to be weakly bound

This is wrong (and should be fixed -- please file a bug report).

First, a section cannot be `weakly bound' at all, only a symbol can.
Second, there's normally no need to declare these symbols weak, as
they come in only on-demand from libgcc.a.  However, third, in the
special case mentioned above, a weak symbol would perhaps make sense,
but that symbol isn't really declared weak, so it will always be
brought in.

I think your best bet is to make a customized copy of the startup
code, and then use -nostartfiles.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

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