Linux PARISC architecture development
 help / color / mirror / Atom feed
* [PATCH] fix compile breakage caused by linux/smp.h header definition problem
@ 2011-03-23 15:11 James Bottomley
  2011-03-23 17:50 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2011-03-23 15:11 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, Amerigo Wang, Parisc List

The problem is this:

  CC      arch/parisc/kernel/asm-offsets.s
In file included from include/linux/sched.h:71,
                 from arch/parisc/kernel/asm-offsets.c:31:
include/linux/smp.h:117: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'setup_nr_cpu_ids'
include/linux/smp.h:118: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'smp_init'
  HOSTLD  scripts/mod/modpost
make[1]: *** [arch/parisc/kernel/asm-offsets.s] Error 1

It's caused by two __init attributes on function prototypes, which
shouldn't be there (__init should only mark functions not prototypes).
This was introduced by

commit 34db18a054c600b6f81787165669dc572fe4de25
Author: Amerigo Wang <amwang@redhat.com>
Date:   Tue Mar 22 16:34:06 2011 -0700

    smp: move smp setup functions to kernel/smp.c

Removing the spurious __init attributes fixes this

Signed-off-by: James Bottomley <James.Bottomley@suse.de>

---

We didn't pick this up in our -next compiles, presumably because the
patch moved rather fast from -next to mainline?

diff --git a/include/linux/smp.h b/include/linux/smp.h
index 48159dd..04d6e0d 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -114,8 +114,8 @@ int on_each_cpu(smp_call_func_t func, void *info, int wait);
 void smp_prepare_boot_cpu(void);
 
 extern unsigned int setup_max_cpus;
-extern void __init setup_nr_cpu_ids(void);
-extern void __init smp_init(void);
+extern void setup_nr_cpu_ids(void);
+extern void smp_init(void);
 
 #else /* !SMP */
 



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix compile breakage caused by linux/smp.h header definition problem
  2011-03-23 15:11 [PATCH] fix compile breakage caused by linux/smp.h header definition problem James Bottomley
@ 2011-03-23 17:50 ` Andrew Morton
  2011-03-23 17:59   ` Mike Frysinger
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2011-03-23 17:50 UTC (permalink / raw)
  To: James Bottomley; +Cc: Linus Torvalds, Amerigo Wang, Parisc List

On Wed, 23 Mar 2011 10:11:58 -0500 James Bottomley <James.Bottomley@suse.de> wrote:

> The problem is this:
> 
>   CC      arch/parisc/kernel/asm-offsets.s
> In file included from include/linux/sched.h:71,
>                  from arch/parisc/kernel/asm-offsets.c:31:
> include/linux/smp.h:117: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'setup_nr_cpu_ids'
> include/linux/smp.h:118: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'smp_init'
>   HOSTLD  scripts/mod/modpost
> make[1]: *** [arch/parisc/kernel/asm-offsets.s] Error 1
> 
> It's caused by two __init attributes on function prototypes,

Heiko sent a patch for this which adds the #include.

> which
> shouldn't be there (__init should only mark functions not prototypes).

Nope.  We've had build failures in the past (on arm) where the
assembler generated a short-addressed branch to a function in the
"same" section but the linker discovered that it was too far away,
because the target landed in a different section.

By correctly marking the target as __init, the compiler says "ah,
that's far away" and generates the long-form branch addressing.

I think it only happened once, and it's obviously hard to hit, because
many such prototypes of __init functions are missing the __init tag.

And as the sections are laid out contiguously (true?), that kernel must
have been real close to having the same linkage error for branches
_within_ the main .text segment.

So it's all a bit fishy and marginal, but adding the __init increases
the chances of keeping Russell happy.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix compile breakage caused by linux/smp.h header definition problem
  2011-03-23 17:50 ` Andrew Morton
@ 2011-03-23 17:59   ` Mike Frysinger
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2011-03-23 17:59 UTC (permalink / raw)
  To: Andrew Morton; +Cc: James Bottomley, Linus Torvalds, Amerigo Wang, Parisc List

On Wed, Mar 23, 2011 at 1:50 PM, Andrew Morton wrote:
> On Wed, 23 Mar 2011 10:11:58 -0500 James Bottomley wrote:
>> The problem is this:
>>
>> =A0 CC =A0 =A0 =A0arch/parisc/kernel/asm-offsets.s
>> In file included from include/linux/sched.h:71,
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0from arch/parisc/kernel/asm-offse=
ts.c:31:
>> include/linux/smp.h:117: error: expected '=3D', ',', ';', 'asm' or '=
__attribute__' before 'setup_nr_cpu_ids'
>> include/linux/smp.h:118: error: expected '=3D', ',', ';', 'asm' or '=
__attribute__' before 'smp_init'
>> =A0 HOSTLD =A0scripts/mod/modpost
>> make[1]: *** [arch/parisc/kernel/asm-offsets.s] Error 1
>>
>> It's caused by two __init attributes on function prototypes,
>
> Heiko sent a patch for this which adds the #include.

thanks, this broke Blackfin SMP too

>> which
>> shouldn't be there (__init should only mark functions not prototypes=
).
>
> Nope. =A0We've had build failures in the past (on arm) where the
> assembler generated a short-addressed branch to a function in the
> "same" section but the linker discovered that it was too far away,
> because the target landed in a different section.

another advantage is that for funcs which are defined in arch code,
putting the attributes on the prototype allow all the arches to get
the right markings without worrying about someone copying & pasting
wrongly.
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc"=
 in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-23 17:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-23 15:11 [PATCH] fix compile breakage caused by linux/smp.h header definition problem James Bottomley
2011-03-23 17:50 ` Andrew Morton
2011-03-23 17:59   ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox