This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: when is ld appending .number to end of section names?


On Sat, Jan 19, 2008 at 11:20:26AM +1030, Alan Modra wrote:
> On Fri, Jan 18, 2008 at 10:42:28PM +0100, Sam Ravnborg wrote:
> > The expected section name was: ".init.text".
> > But the actual section name was ".init.text.1"
> 
> Quoting from ld/emultemp/elf32.em
> 
>   /* Choose a unique name for the section.  This will be needed if the
>      same section name appears in the input file with different
>      loadable or allocatable characteristics.  */
> 
> Most likely someone forgot to flag .init.text with "ax" in one of the
> input object files.  Another possiblility is that ld --unique was
> used.

Thanks Alan - it was a case of missing "ax" as you expected.

See: http://lkml.org/lkml/2008/1/19/51

Having started to look into this I tried to dig a bit more into the
subject of sections and assembler code.

In the kernel we have following ways to specify the .init.text section:
a) .section .init.text, "ax"
b) .section ".init.text", "ax"
c) .section ".init.text", #alloc, #execinstr
d) .section .init.text, "ax", @progbits

It is my understanding that a) b) and c) are equal.
And the preferred syntax is a) (I would prefer c) as it is more descriptive)

The syntax in d) is used in some places.
What is the significance of specifying @progbits?

The main reason I bring up this question is that I cannot create
a macro like this:
#define __INIT .section .init.text, "ax", @progbits

as it would fail on ARM where '@' is used to specify a comment.

So the simplest solution would be to just drop "@progbits",
but before that I would like to understand the usage.

An explanation of the use of "@progbits" would be good - but
a pointer to some documentation would be preferred as I then can
read up on this instead of asking.

info gas told me this:

`@progbits'
     section contains data

`@nobits'
     section does not contain data (i.e., section only occupies space)

But that did not convince me that the use of "@progbits" was optional and
could be dropped.


Thanks in advance,

	Sam


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