lkml.org 
[lkml]   [2001]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: const __init
On Sun, May 20, 2001 at 05:34:48PM -0400, Jeff Garzik wrote:
> This might be a very valid point...
>
> (let me know if the following test is flawed)

It is imho.

> > [jgarzik@rum tmp]$ cat > sectest.c
> > #include <linux/module.h>
> > #include <linux/init.h>
> > static const char version[] __initdata = "foo";
static char version2[] __initdata = "bar";
> > [jgarzik@rum tmp]$ gcc -D__KERNEL__ -I/spare/cvs/linux_2_4/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -mpreferred-stack-boundary=2 -march=i686 -c -o sectest.o sectest.c
> > [jgarzik@rum tmp]$
>
> No section type conflict appears.

Now it SHOULD conflict on these binutils, but doesn't on mine (2.9.5) ;-)

It is decided to put it into .data.init as expected.

AFAIK "const" is only a promise to the compiler, that we write
this data ONCE and read only after this initial write. So the
decision on the section is implementation defined.

What I don't understand is, why GCC overrides our explicit
override (done by setting the "section attribute" explicitly).

I would consider this a BUG in GCC. I don't understand, why we
support this BUG...

Maybe some GCC people can enlighten me, why GCC ignores such
overrides, that are for the cases where we DO KNOW BETTER than
GCC, what section is correct.


Regards

Ingo Oeser
--
To the systems programmer,
users and applications serve only to provide a test load.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:53    [W:0.059 / U:2.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site