linux-mips
[Top] [All Lists]

Re: [RFC] Add __initbss section

To: "Maciej W. Rozycki" <macro@linux-mips.org>
Subject: Re: [RFC] Add __initbss section
From: Franck Bui-Huu <vagabon.xyz@gmail.com>
Date: Thu, 18 Oct 2007 22:28:43 +0200
Cc: Ralf Baechle <ralf@linux-mips.org>, Geert Uytterhoeven <geert@linux-m68k.org>, linux-mips <linux-mips@linux-mips.org>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; bh=IF9MgppG3PTMa4fKzju5B1U+a87DTPBxcxs0j713Vp0=; b=STdyhSgNou5Bt3Q31zBl4arsArmpqX7qovKAsRjzGeNZOEn2LFwDpra19m3SozI34Rkzv7n5yaMYZgT+ZUCFHWbXUAOAIiBxpEoyH+t2wiSUvglBr58dYc+zA5nUUl5sjcKi2QuyajQZ+hUZy78IgDbqyZEjbfMiWxX7+USjXNk=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=IvBH7tk/tw8Nk1yfdVX6mM7NlTIBVvcyh0e7oThTeQHCJgN8xTDgcpjqOkfuhSL6PQO8xEW6b5mN7+5dVfHQ6J/mh8QXmPBZVMxa82O7pr4InGAU25NxpzqpD9qDKWOcSnbWPoWa5DWcz1l6AdUCaJ5pCAx4jrrGeVuvs8KBpAQ=
In-reply-to: <Pine.LNX.4.64N.0710161123110.22596@blysk.ds.pg.gda.pl>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <470DF25E.60009@gmail.com> <Pine.LNX.4.64N.0710111307180.16370@blysk.ds.pg.gda.pl> <4712738A.5000703@gmail.com> <Pine.LNX.4.64N.0710151311350.16262@blysk.ds.pg.gda.pl> <4713C840.8080206@gmail.com> <Pine.LNX.4.64N.0710161123110.22596@blysk.ds.pg.gda.pl>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0.0.5 (X11/20070719)
Maciej W. Rozycki wrote:
> On Mon, 15 Oct 2007, Franck Bui-Huu wrote:
> 
>> Well, since .init.bss is declared as follow:
>>
>>      .init.bss (NOLOAD) : {
>>              ...
>>      }
>>
>> data should not take any space in the image...
> 
>  The above only marks it as unloadable (cf. e.g. debugging information).  
> It is still there.
> 

So it seems there is no way from a linker script to specify that a
section has the nobits type, is it ?

After spending some fun time trying several different configurations
with gcc and ld, I noticed that gcc makes a section with @nobits
attribute if the section name starts with .bss.*

So calling .bss.init instead of .init.bss makes gcc do the right
thing. Here is a bit of tlbex.s:

                .word   0
                .section        .bss.init,"aw",@nobits
                .align  2
                .type   tlb_handler, @object
                .size   tlb_handler, 512
        tlb_handler:
                .space  512
                .align  2
                .type   labels, @object
                .size   labels, 1024
        labels:
                .space  1024


Another test I did is to put .init.bss (not .bss.init) section right
before .bss section in order to have only one segment to load. And it
makes magically ld do the right thing. I must admit that I don't
understand why, and the lack of documentation doesn't help...

Unfortunately I don't know if we can rely on one of these
behaviours. IOW if they're going to work with all supported versions
of gcc/ld.

Anyway, I'll resubmit a new patchset for futher discussion.

                Franck

<Prev in Thread] Current Thread [Next in Thread>