linux-next: kbuild tree build failure
Subsystems (2)
Hi Sam,
Today's linux-next build (powerpc ppc64_defconfig) failed like this:
fs/nfs/nfsroot.c:400: error: __setup_str_nfs_root_setup causes a section type conflict fs/nfs/nfsroot.c:400: error: __setup_str_nfs_root_setup causes a section type conflict
We get these occasionally on powerpc builds - Usually from EXPORT_SYMBOLS. Though I was hoping that using a newer compiler would fix that (I am now compiling with gcc 4.4.0).
Direct cause is commit efbe795f5f63b74ed642e196518907355aa94bd7 ("initconst adjustments").
OK, looking at the preprocessor output, I see we have a previous variable (static match_table_t __initconst tokens) with __attribute__ ((__section__ (".init.rodata"))) but it is not const ... (This came from commit a447c0932445f92ce6f4c1bd020f62c5097a7842 "vfs: Use const for kernel parser table" which changed "tokens" from __initdata to __initconst. Not using "const" seems deliberate, but the changelog does not include enough information as to why.)
So, I will revert the above commit for today to allow it to be "improved" by also fixing the tokens variable definition above. Of course there may be other places where such mixed definitions exist.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Stephen Rothwell <[email protected]> 05.05.09 03:17 >>>
OK, looking at the preprocessor output, I see we have a previous variable (static
match_table_t__initconsttokens) with__attribute__((__section__(".init.rodata"))) but it is not const ... (This came from commita447c0932445f92ce6f4c1bd020f62c5097a7842"vfs: Use const for kernel parser table" which changed "tokens" from__initdatato__initconst. Not using "const" seems deliberate, but the changelog does not include enough information as to why.)
Quoted 3 lines
So, I will revert the above commit for today to allow it to be "improved" by also fixing the tokens variable definition above. Of course there may be other places where such mixed definitions exist.
That is the downside of not folding the 'const' modifier into the __initconst annotation. It is *always* an error to annotate something __initconst but not also make it const.
Jan
Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Stephen Rothwell <[email protected]> 05.05.09 03:17 >>>
OK, looking at the preprocessor output, I see we have a previous variable (static
match_table_t__initconsttokens) with__attribute__((__section__(".init.rodata"))) but it is not const ... (This came from commita447c0932445f92ce6f4c1bd020f62c5097a7842"vfs: Use const for kernel parser table" which changed "tokens" from__initdatato__initconst. Not using "const" seems deliberate, but the changelog does not include enough information as to why.)
Quoted 7 lines
Quoted 3 lines
So, I will revert the above commit for today to allow it to be "improved" by also fixing the tokens variable definition above. Of course there may be other places where such mixed definitions exist.
That is the downside of not folding the 'const' modifier into the
__initconstannotation. It is *always* an error to annotate something__initconstbut not also make it const.
But if we folded const in __initconst would this be correct:
drivers/net/eql.c:static const char version[] __initconst =
?
It is now:
static const char version[] = ...
And will become:
static char version[] const =
gcc does not like the latter:
$ cat jan.c: static const char version[] = "oldstuff"; static char version2[] const = "newstuff";
void foo(const char bar[])
{
}
void baz()
{
foo(version);
foo(version2);
}
$ gcc jan.c:
jan.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'const'
jan.c: In function 'baz':
jan.c:11: error: 'version2' undeclared (first use in this function)
jan.c:11: error: (Each undeclared identifier is reported only once
jan.c:11: error: for each function it appears in.)Sam
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Sam Ravnborg <[email protected]> 05.05.09 08:43 >>>
Quoted 3 lines · Jan Beulich
That is the downside of not folding the 'const' modifier into the
__initconstannotation. It is *always* an error to annotate something__initconstbut not also make it const.But if we folded const in
__initconstwould this be correct:drivers/net/eql.c:static const char version[]
__initconst=
No, of course not. __initconst would need to go in the place where const is now. My original patch (from really long ago) did this, but you didn't like that combination. Changing to such a model now (where we already have quite a number of uses of __initconst) is certainly going to be painful, so I'm not sure it's worth it. And if you would think now we should nevertheless convert, we'd have to first check whether declarations of more than one variable with a single declaration works with all supported gcc versions (since there are a number of caveats with how __attribute__() annotations are handled depending on their placement) - it may well be that there would need to be a one-variable-per-declaration constraint on users of __initconst & Co.
Jan
PATCH 1/1 nfs: fix build error in nfsroot with initconst
In reply to Stephen Rothwellfix build error with latest kbuild adjustments to initconst.
The commit a447c0932445f92ce6f4c1bd020f62c5097a7842 ("vfs: Use const for kernel parser table") changed:
static match_table_t __initdata tokens = {
to
static match_table_t __initconst tokens = {But the missing const causes popwerpc to fail with latest updates to __initconst like this:
fs/nfs/nfsroot.c:400: error: __setup_str_nfs_root_setup causes a section type conflict fs/nfs/nfsroot.c:400: error: __setup_str_nfs_root_setup causes a section type conflict
The bug is only present with kbuild-next.
Following patch has been build tested.
---
Please apply this either to your -next tree or preferably upstream.
Sam
fs/nfs/nfsroot.c +1 -1
@@ -129,7 +129,7 @@ enum {Opt_err }; -static match_table_t __initconst tokens = { +static const match_table_t tokens__initconst = { {Opt_port,"port=%u" }, {Opt_rsize,"rsize=%u" }, {Opt_wsize,"wsize=%u" },
Re: [PATCH] nfs: fix build error in nfsroot with initconst
Quoted 1 line
Quoted 1 line
Quoted 1 line
Sam Ravnborg <[email protected]> 05.05.09 13:11 >>>
fix build error with latest kbuild adjustments to initconst.
The commit a447c0932445f92ce6f4c1bd020f62c5097a7842 ("vfs: Use const for kernel parser table") changed:
static match_table_t __initdata tokens = {
to
static match_table_t __initconst tokens = {But the missing const causes popwerpc to fail with latest updates to __initconst like this:
fs/nfs/nfsroot.c:400: error: __setup_str_nfs_root_setup causes a section type conflict fs/nfs/nfsroot.c:400: error: __setup_str_nfs_root_setup causes a section type conflict
The bug is only present with kbuild-next.
Following patch has been build tested.
---
Please apply this either to your -next tree or preferably upstream.
Sam
fs/nfs/nfsroot.c +1 -1
@@ -129,7 +129,7 @@ enum {Opt_err }; -static match_table_t __initconst tokens = { +static const match_table_t tokens__initconst = { {Opt_port,"port=%u" }, {Opt_rsize,"rsize=%u" }, {Opt_wsize,"wsize=%u" },
Re: [PATCH] nfs: fix build error in nfsroot with initconst
In reply to Sam RavnborgHi Sam,
Quoted 16 lines · On Tue, 5 May 2009 13:11:14 +0200 Sam Ravnborg <[email protected]> wrote:
fix build error with latest kbuild adjustments to initconst.
The commit
a447c0932445f92ce6f4c1bd020f62c5097a7842("vfs: Use const for kernel parser table") changed:static match_table_t __initdata tokens = { to static match_table_t __initconst tokens = {But the missing const causes popwerpc to fail with latest updates to
__initconstlike this:
fs/nfs/nfsroot.c:400: error:__setup_str_nfs_root_setupcauses a section type conflictfs/nfs/nfsroot.c:400: error:__setup_str_nfs_root_setupcauses a section type conflict
Quoted 6 lines
The bug is only present with kbuild-next.
Following patch has been build tested.Signed-off-by Sam Ravnborg <[email protected]>Cc Steven Whitehouse <[email protected]>Cc Stephen Rothwell <[email protected]>
I build tested this with the offending compilers, so
I also build tested with the updates to __initconst as well.
Quoted 1 line
Please apply this either to your -next tree or preferably upstream.
If you want to keep the __initconst changes in your tree, then you need the above in your tree as well ... (preferably before the __initconst changes).
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH] nfs: fix build error in nfsroot with initconst
Quoted 31 lines · Stephen Rothwell
Hi Sam,
Quoted 16 lines · On Tue, 5 May 2009 13:11:14 +0200 Sam Ravnborg <[email protected]> wrote:
fix build error with latest kbuild adjustments to initconst.
The commit
a447c0932445f92ce6f4c1bd020f62c5097a7842("vfs: Use const for kernel parser table") changed:static match_table_t __initdata tokens = { to static match_table_t __initconst tokens = {But the missing const causes popwerpc to fail with latest updates to
__initconstlike this:
fs/nfs/nfsroot.c:400: error:__setup_str_nfs_root_setupcauses a section type conflictfs/nfs/nfsroot.c:400: error:__setup_str_nfs_root_setupcauses a section type conflictQuoted 6 lines
The bug is only present with kbuild-next.
Following patch has been build tested.Signed-off-by Sam Ravnborg <[email protected]>Cc Steven Whitehouse <[email protected]>Cc Stephen Rothwell <[email protected]>I build tested this with the offending compilers, so
Tested-by Stephen Rothwell <[email protected]>Acked-by Stephen Rothwell <[email protected]>
Quoted 7 lines
I also build tested with the updates to
__initconstas well.Quoted 1 line
Please apply this either to your -next tree or preferably upstream.
If you want to keep the
__initconstchanges in your tree, then you need the above in your tree as well ... (preferably before the__initconstchanges).
I hope that Trond would pull it into his tree and get it upstream.
But if this does not happen within a few days (or Trond says I should do so), I will add it to the kbuild-next.git.
Sam
Re: [PATCH] nfs: fix build error in nfsroot with initconst
Quoted 39 lines · Sam Ravnborg
Quoted 31 lines · Stephen Rothwell
Hi Sam,
Quoted 16 lines · On Tue, 5 May 2009 13:11:14 +0200 Sam Ravnborg <[email protected]> wrote:
fix build error with latest kbuild adjustments to initconst.
The commit
a447c0932445f92ce6f4c1bd020f62c5097a7842("vfs: Use const for kernel parser table") changed:static match_table_t __initdata tokens = { to static match_table_t __initconst tokens = {But the missing const causes popwerpc to fail with latest updates to
__initconstlike this:
fs/nfs/nfsroot.c:400: error:__setup_str_nfs_root_setupcauses a section type conflictfs/nfs/nfsroot.c:400: error:__setup_str_nfs_root_setupcauses a section type conflictQuoted 6 lines
The bug is only present with kbuild-next.
Following patch has been build tested.Signed-off-by Sam Ravnborg <[email protected]>Cc Steven Whitehouse <[email protected]>Cc Stephen Rothwell <[email protected]>I build tested this with the offending compilers, so
Tested-by Stephen Rothwell <[email protected]>Acked-by Stephen Rothwell <[email protected]>Quoted 7 lines
I also build tested with the updates to
__initconstas well.Quoted 1 line
Please apply this either to your -next tree or preferably upstream.
If you want to keep the
__initconstchanges in your tree, then you need the above in your tree as well ... (preferably before the__initconstchanges).
Quoted 7 lines
I hope that Trond would pull it into his tree and get it upstream.
But if this does not happen within a few days (or Trond says I should do so), I will add it to the kbuild-next.git.
Sam
I've got some stuff from Chuck that I need to send upstream too, so I expect to send it in the next couple of days...
Signature · 6 lines
Trond Myklebust Linux NFS client maintainer NetApp [email protected] www.netapp.com
Re: [PATCH] nfs: fix build error in nfsroot with initconst
In reply to Stephen RothwellHi Trond,
Quoted 21 lines · On Wed, 6 May 2009 13:32:53 +1000 Stephen Rothwell <[email protected]> wrote:
Quoted 19 lines · On Tue, 5 May 2009 13:11:14 +0200 Sam Ravnborg <[email protected]> wrote:
fix build error with latest kbuild adjustments to initconst.
The commit
a447c0932445f92ce6f4c1bd020f62c5097a7842("vfs: Use const for kernel parser table") changed:static match_table_t __initdata tokens = { to static match_table_t __initconst tokens = {But the missing const causes popwerpc to fail with latest updates to
__initconstlike this:
fs/nfs/nfsroot.c:400: error:__setup_str_nfs_root_setupcauses a section type conflictfs/nfs/nfsroot.c:400: error:__setup_str_nfs_root_setupcauses a section type conflictThe bug is only present with kbuild-next.
Following patch has been build tested.
Quoted 8 lines
Quoted 3 lines
Signed-off-by Sam Ravnborg <[email protected]>Cc Steven Whitehouse <[email protected]>Cc Stephen Rothwell <[email protected]>I build tested this with the offending compilers, so
Tested-by Stephen Rothwell <[email protected]>Acked-by Stephen Rothwell <[email protected]>
Any reason this has not appeared in the nfs (or Linus') tree yet?
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/