[Top] [All Lists]

Re: [RFC] Add __initbss section

To: "Maciej W. Rozycki" <>
Subject: Re: [RFC] Add __initbss section
From: Franck Bui-Huu <>
Date: Thu, 18 Oct 2007 22:28:43 +0200
Cc: Ralf Baechle <>, Geert Uytterhoeven <>, linux-mips <>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; 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;; 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: <>
Original-recipient: rfc822;
References: <> <> <> <> <> <>
User-agent: Thunderbird (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
                .space  512
                .align  2
                .type   labels, @object
                .size   labels, 1024
                .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.


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