Re: Please include const-sections into linux-next

Andi Kleen
2011-10-19T19:05:22Z

On Wed, Oct 19, 2011 at 01:55:57PM -0500, James Bottomley wrote:
> On Wed, 2011-10-19 at 18:33 +0200, Andi Kleen wrote:
> > > OK, look at it another way: why do we need the type annotations? I
> > > think it's only for section conflict checking, right? If the compiler
> > > gets it wrong anyway, why not just dump all the type annotations, then
> > > it should have no type conflicts (spurious or otherwise) to complain
> > > about. We already have link time section checking scripts (they're the
> > > useless ones that complain about section mismatches in dev annoations)
> > > so why not put them to work to make up for compiler deficiencies?
> >
> > You mean removing all the init sections stuff? I think it has been proposed
> > in the past, but it's a couple of hundred KB of memory usually.
> > Would you accept that for PA-RISC?
> >
> > If you have init sections you need to annotate them correctly because
> > a section is defined by its rwx attributes plus name and both need
> > to match. We didn't always check this, so there was some bitrot,
> > but it ultimatively has to be correct.
>
> We're talking at cross purposes. But it doesn't matter, the error
> doesn't seem to be anything to do with type. This simple patch is
> what's causing it (I can apply it alone to the working tree) and get the
> error.
>
> What I can't see is why.

For some reason your compiler sets the const section read/write:

.section .devinit.data,"aw",@progbits <---- writable
.align 8
.type skel_netdrv_tbl, @object
.size skel_netdrv_tbl, 48
skel_netdrv_tbl:
; chip_name:
.dword .LC56

while my x86 toolchain sets it to read only

.string "1000/100/10M Ethernet PCI Adapter"
.section .devinit.data,"a",@progbits <---- not writable
.align 16
.type skel_netdrv_tbl, @object
.size skel_netdrv_tbl, 48
skel_netdrv_tbl:
# chip_name:
.quad .LC32
# flags:
.long 0
.zero 4

If you check a few other const symbols with own
section are they all also writable?

-andi