Skip to contentSkip to conversation

linux-next: kbuild tree build failure

PATCH In review Stephen Rothwell 4 participants 10 messages May 5, 2009 – May 20, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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/
#1 lore raw
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 __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.)

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

#2 lore raw
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 __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.)

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 __initconst annotation. It is *always* an error to annotate something __initconst but 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

#3 lore raw
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 __initconst annotation. It is *always* an error to annotate something __initconst but 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 =

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

#4 lore raw

PATCH 1/1 nfs: fix build error in nfsroot with initconst

In reply to Stephen Rothwell

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.

Cc Steven Whitehouse <[email protected]>
Cc Stephen Rothwell <[email protected]>

---

Please apply this either to your -next tree or preferably upstream.

Sam

fs/nfs/nfsroot.c +1 -1
index d9ef602..e3ed590 100644
@@ -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"},
Acked-by on v1 1/1
#5 lore raw

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.

Cc Steven Whitehouse <[email protected]>
Cc Stephen Rothwell <[email protected]>

---

Please apply this either to your -next tree or preferably upstream.

Sam

fs/nfs/nfsroot.c +1 -1
index d9ef602..e3ed590 100644
@@ -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"},
author Tested-by Acked-by on v1 1/1
#6 lore raw

Re: [PATCH] nfs: fix build error in nfsroot with initconst

In reply to Sam Ravnborg

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 __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

Quoted 6 lines

The bug is only present with kbuild-next.
Following patch has been build tested.

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/
#7 lore raw

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 __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

Quoted 6 lines

The bug is only present with kbuild-next.
Following patch has been build tested.

Cc Steven Whitehouse <[email protected]>
Cc Stephen Rothwell <[email protected]>

I build tested this with the offending compilers, so

Quoted 7 lines

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).

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

#8 lore raw

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 __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

Quoted 6 lines

The bug is only present with kbuild-next.
Following patch has been build tested.

Cc Steven Whitehouse <[email protected]>
Cc Stephen Rothwell <[email protected]>

I build tested this with the offending compilers, so

Quoted 7 lines

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).

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
#9 lore raw

Re: [PATCH] nfs: fix build error in nfsroot with initconst

In reply to Stephen Rothwell

Hi 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 __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.

Quoted 8 lines
Quoted 3 lines
Cc Steven Whitehouse <[email protected]>
Cc Stephen Rothwell <[email protected]>

I build tested this with the offending compilers, so

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/