Re: const __init

2001-05-21 Thread J . A . Magallon
On 05.21 Richard Henderson wrote: > On Mon, May 21, 2001 at 01:07:50PM +1000, Keith Owens wrote: > > does cause a section conflict, egcs 1.1.2. > > > > Interestingly enough, if var[12] are together, without the intervening > > text, then gcc does not flag an error, instead it puts both

Re: const __init

2001-05-21 Thread Jamie Lokier
Richard Henderson wrote: > No, the problem is not with which section, but what flags that > section should have. If you put only "const" data in a section, > then the section should have SHF_WRITE clear. Conversely, if > you put writable data in a section then SHF_WRITE should be set. > > Now,

Re: const __init

2001-05-21 Thread Richard Henderson
On Mon, May 21, 2001 at 01:07:50PM +1000, Keith Owens wrote: > does cause a section conflict, egcs 1.1.2. > > Interestingly enough, if var[12] are together, without the intervening > text, then gcc does not flag an error, instead it puts both variables > in section .data.init and marks it as

Re: const __init

2001-05-21 Thread Keith Owens
On Sun, 20 May 2001 17:34:48 -0400, Jeff Garzik <[EMAIL PROTECTED]> wrote: >(let me know if the following test is flawed) > > [jgarzik@rum tmp]$ cat > sectest.c > #include > #include > static const char version[] __initdata = "foo"; > [jgarzik@rum tmp]$ gcc -D__KERNEL__

Re: const __init

2001-05-21 Thread Keith Owens
On Sun, 20 May 2001 17:34:48 -0400, Jeff Garzik [EMAIL PROTECTED] wrote: (let me know if the following test is flawed) [jgarzik@rum tmp]$ cat sectest.c #include linux/module.h #include linux/init.h static const char version[] __initdata = foo; [jgarzik@rum tmp]$ gcc -D__KERNEL__

Re: const __init

2001-05-21 Thread Richard Henderson
On Mon, May 21, 2001 at 01:07:50PM +1000, Keith Owens wrote: does cause a section conflict, egcs 1.1.2. Interestingly enough, if var[12] are together, without the intervening text, then gcc does not flag an error, instead it puts both variables in section .data.init and marks it as read

Re: const __init

2001-05-21 Thread Jamie Lokier
Richard Henderson wrote: No, the problem is not with which section, but what flags that section should have. If you put only const data in a section, then the section should have SHF_WRITE clear. Conversely, if you put writable data in a section then SHF_WRITE should be set. Now, one

Re: const __init

2001-05-21 Thread J . A . Magallon
On 05.21 Richard Henderson wrote: On Mon, May 21, 2001 at 01:07:50PM +1000, Keith Owens wrote: does cause a section conflict, egcs 1.1.2. Interestingly enough, if var[12] are together, without the intervening text, then gcc does not flag an error, instead it puts both variables in

Re: const __init

2001-05-20 Thread Richard Henderson
On Mon, May 21, 2001 at 12:19:49AM +0200, Ingo Oeser wrote: > 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. No, the problem is not with which section, but what

Re: const __init

2001-05-20 Thread Keith Owens
On Sun, 20 May 2001 22:16:11 +0200, Franz Sirl <[EMAIL PROTECTED]> wrote: >Yes, and gcc3 errors on these constructs, cause it cannot decide if the data >should be put into a .data or .rodata section. >Dunno if it's worth to create a __initconstdata/__initrodata though, but it >would be easy

Re: const __init

2001-05-20 Thread Ingo Oeser
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 > > #include > > static const char version[] __initdata = "foo"; static

Re: const __init

2001-05-20 Thread Russell King
On Sun, May 20, 2001 at 09:51:04PM +0200, Geert Uytterhoeven wrote: > Appendix: here's the list of affected source files: > > arch/arm/kernel/setup.c Thanks for pointing it out. -- Russell King ([EMAIL PROTECTED])The developer of ARM Linux

Re: const __init

2001-05-20 Thread Jeff Garzik
Geert Uytterhoeven wrote: > > On Sun, 20 May 2001, Jeff Garzik wrote: > > Geert Uytterhoeven wrote: > > > Since a while include/linux/init.h contains the line > > > > > > * Also note, that this data cannot be "const". > > > > > > Why is this? Because const data will be put in a different

Re: const __init

2001-05-20 Thread Geert Uytterhoeven
On Sun, 20 May 2001, Jeff Garzik wrote: > Geert Uytterhoeven wrote: > > Since a while include/linux/init.h contains the line > > > > * Also note, that this data cannot be "const". > > > > Why is this? Because const data will be put in a different section? > > Causes a "section type

Re: const __init

2001-05-20 Thread Franz Sirl
On Sunday 20 May 2001 21:51, Geert Uytterhoeven wrote: > Since a while include/linux/init.h contains the line > > * Also note, that this data cannot be "const". > > Why is this? Because const data will be put in a different section? Yes, and gcc3 errors on these constructs, cause it cannot

Re: const __init

2001-05-20 Thread Jeff Garzik
Geert Uytterhoeven wrote: > > Since a while include/linux/init.h contains the line > > * Also note, that this data cannot be "const". > > Why is this? Because const data will be put in a different section? Causes a "section type conflict" build error, at least on x86. > FWIW, many

const __init

2001-05-20 Thread Geert Uytterhoeven
Since a while include/linux/init.h contains the line * Also note, that this data cannot be "const". Why is this? Because const data will be put in a different section? However, quite some code defines const __init variables (see list below). So what should be done now? 1. Re

Re: const __init

2001-05-20 Thread Franz Sirl
On Sunday 20 May 2001 21:51, Geert Uytterhoeven wrote: Since a while include/linux/init.h contains the line * Also note, that this data cannot be const. Why is this? Because const data will be put in a different section? Yes, and gcc3 errors on these constructs, cause it cannot decide

Re: const __init

2001-05-20 Thread Geert Uytterhoeven
On Sun, 20 May 2001, Jeff Garzik wrote: Geert Uytterhoeven wrote: Since a while include/linux/init.h contains the line * Also note, that this data cannot be const. Why is this? Because const data will be put in a different section? Causes a section type conflict build error,

Re: const __init

2001-05-20 Thread Russell King
On Sun, May 20, 2001 at 09:51:04PM +0200, Geert Uytterhoeven wrote: Appendix: here's the list of affected source files: arch/arm/kernel/setup.c Thanks for pointing it out. -- Russell King ([EMAIL PROTECTED])The developer of ARM Linux

Re: const __init

2001-05-20 Thread Ingo Oeser
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;

Re: const __init

2001-05-20 Thread Richard Henderson
On Mon, May 21, 2001 at 12:19:49AM +0200, Ingo Oeser wrote: 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. No, the problem is not with which section, but what flags