Re: [RFC] Add __initbss section

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

 



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


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux