lkml.org 
[lkml]   [2001]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: const __init
Date
On Sun, 20 May 2001 17:34:48 -0400, 
Jeff Garzik <jgarzik@mandrakesoft.com> 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__ -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.

With just one variable in initdata there is no conflict, it takes two
to conflict.

static const char var1[] __attribute__ ((__section__ (".data.init"))) = "foo";
int main(void) { return(0); }
static int var2[] __attribute__ ((__section__ (".data.init"))) = {0,1};

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 only. This looks like a bug
in gcc.

-
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 13:17    [W:0.580 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site