public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [Patch] Compilation error on 2.5.8
  2002-04-15 22:53 [Patch] Compilation error on 2.5.8 Bongani
@ 2002-04-15 22:45 ` Robert Love
  2002-04-15 23:34   ` Bongani
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Love @ 2002-04-15 22:45 UTC (permalink / raw)
  To: Bongani; +Cc: Linux Kernel

On Mon, 2002-04-15 at 18:53, Bongani wrote:
> I get the following error when I try to compile 2.5.8
> init/main.o: In function `start_kernel':
> init/main.o(.text.init+0x5e2): undefined reference to
> `setup_per_cpu_areas'
> 
> Looking at the code it looks like someone got confused ;)
> around the ifdefs.I'm  under the assumption that setup_per_cpu_areas()
> does nothing on a uniprocessor. The patch compile fine on 
> my PC. 

A better approach would probably be to define setup_per_cpu_areas to
nothing when CONFIG_SMP is not set so as not to have #ifdefs in the code
itself ...  for example,

diff -urN linux-2.5.8/init/main.c linux/init/main.c
--- linux-2.5.8/init/main.c	Sun Apr 14 15:18:46 2002
+++ linux/init/main.c	Mon Apr 15 18:41:54 2002
@@ -272,6 +272,8 @@
 #define smp_init()	do { } while (0)
 #endif
 
+#define setup_per_cpu_areas()	do { } while(0)
+
 #else
 
 #ifdef __GENERIC_PER_CPU

	Robert Love



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

* [Patch] Compilation error on 2.5.8
@ 2002-04-15 22:53 Bongani
  2002-04-15 22:45 ` Robert Love
  0 siblings, 1 reply; 6+ messages in thread
From: Bongani @ 2002-04-15 22:53 UTC (permalink / raw)
  To: Linux Kernel

I get the following error when I try to compile 2.5.8
init/main.o: In function `start_kernel':
init/main.o(.text.init+0x5e2): undefined reference to
`setup_per_cpu_areas'

Looking at the code it looks like someone got confused ;)
around the ifdefs.I'm  under the assumption that setup_per_cpu_areas()
does nothing on a uniprocessor. The patch compile fine on 
my PC. 


--- init/main.c Tue Apr 16 00:33:04 2002
+++ init/main.c_new     Tue Apr 16 00:32:51 2002
@@ -344,7 +344,9 @@
        lock_kernel();
        printk(linux_banner);
        setup_arch(&command_line);
+#ifdef CONFIG_SMP
        setup_per_cpu_areas();
+#endif
        printk("Kernel command line: %s\n", saved_command_line);
        parse_options(command_line);
        trap_init();



Cheers
	-Bongani


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

* Re: [Patch] Compilation error on 2.5.8
  2002-04-15 23:34   ` Bongani
@ 2002-04-15 23:24     ` Robert Love
  2002-04-16  4:57       ` Bongani
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Love @ 2002-04-15 23:24 UTC (permalink / raw)
  To: Bongani; +Cc: Linux Kernel

On Mon, 2002-04-15 at 19:34, Bongani wrote:

> Does this also look cleaner ?

> -static inline void setup_per_cpu_areas(void)
> -{
> -}
> +
> +#define setup_per_cpu_areas()  do { } while(0)
> +

Personally yes, but others would disagree.

In fact, if we use a define setup_per_cpu_areas can not be used outside
of this compilation unit.  Right now this looks to be the case, but if
something other than init/main.c wanted to use setup_per_cpu_areas we
would need to make the code an actual function or put the define in a
header file.

Since either case should optimize away, maybe we should make it a static
inline in both cases, since that is the authors original preference ...

	Robert Love


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

* Re: [Patch] Compilation error on 2.5.8
  2002-04-15 22:45 ` Robert Love
@ 2002-04-15 23:34   ` Bongani
  2002-04-15 23:24     ` Robert Love
  0 siblings, 1 reply; 6+ messages in thread
From: Bongani @ 2002-04-15 23:34 UTC (permalink / raw)
  To: Robert Love; +Cc: Linux Kernel

On Tue, 2002-04-16 at 00:45, Robert Love wrote:
> On Mon, 2002-04-15 at 18:53, Bongani wrote:
> > I get the following error when I try to compile 2.5.8
> > init/main.o: In function `start_kernel':
> > init/main.o(.text.init+0x5e2): undefined reference to
> > `setup_per_cpu_areas'
> > 
> > Looking at the code it looks like someone got confused ;)
> > around the ifdefs.I'm  under the assumption that setup_per_cpu_areas()
> > does nothing on a uniprocessor. The patch compile fine on 
> > my PC. 
> 
> A better approach would probably be to define setup_per_cpu_areas to
> nothing when CONFIG_SMP is not set so as not to have #ifdefs in the code
> itself ...  for example,
> 
> diff -urN linux-2.5.8/init/main.c linux/init/main.c
> --- linux-2.5.8/init/main.c	Sun Apr 14 15:18:46 2002
> +++ linux/init/main.c	Mon Apr 15 18:41:54 2002
> @@ -272,6 +272,8 @@
>  #define smp_init()	do { } while (0)
>  #endif
>  
> +#define setup_per_cpu_areas()	do { } while(0)
> +
>  #else
>  
>  #ifdef __GENERIC_PER_CPU
> 

Does this also look cleaner ?

--- init/main.c Tue Apr 16 01:31:29 2002
+++ init/main.c_new     Tue Apr 16 01:30:13 2002
@@ -272,6 +272,8 @@
 #define smp_init()     do { } while (0)
 #endif

+#define setup_per_cpu_areas()  do { } while(0)
+
 #else

 #ifdef __GENERIC_PER_CPU
@@ -297,9 +299,9 @@
        }
 }
 #else
-static inline void setup_per_cpu_areas(void)
-{
-}
+
+#define setup_per_cpu_areas()  do { } while(0)
+
 #endif /* !__GENERIC_PER_CPU */

 /* Called by boot processor to activate the rest. */




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

* Re: [Patch] Compilation error on 2.5.8
  2002-04-16  4:57       ` Bongani
@ 2002-04-16  4:48         ` Robert Love
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Love @ 2002-04-16  4:48 UTC (permalink / raw)
  To: Bongani; +Cc: Linux Kernel

On Tue, 2002-04-16 at 00:57, Bongani wrote:
> Ok, so this patch should be fine then

I likee.

> --- init/main.c Tue Apr 16 06:52:20 2002
> +++ init/main.c_new     Tue Apr 16 06:55:17 2002
> @@ -272,6 +272,10 @@
>  #define smp_init()     do { } while (0)
>  #endif
> 
> +static inline void setup_per_cpu_areas(void)
> +{
> +}
> +
>  #else
> 
>  #ifdef __GENERIC_PER_CPU
> @@ -297,9 +301,11 @@
>         }
>  }
>  #else
> +
>  static inline void setup_per_cpu_areas(void)
>  {
>  }
> +
>  #endif /* !__GENERIC_PER_CPU */
> 
>  /* Called by boot processor to activate the rest. */

	Robert Love


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

* Re: [Patch] Compilation error on 2.5.8
  2002-04-15 23:24     ` Robert Love
@ 2002-04-16  4:57       ` Bongani
  2002-04-16  4:48         ` Robert Love
  0 siblings, 1 reply; 6+ messages in thread
From: Bongani @ 2002-04-16  4:57 UTC (permalink / raw)
  To: Robert Love; +Cc: Linux Kernel

On Tue, 2002-04-16 at 01:24, Robert Love wrote:
> On Mon, 2002-04-15 at 19:34, Bongani wrote:
> 
> > Does this also look cleaner ?
> 
> > -static inline void setup_per_cpu_areas(void)
> > -{
> > -}
> > +
> > +#define setup_per_cpu_areas()  do { } while(0)
> > +
> 
> Personally yes, but others would disagree.
> 
> In fact, if we use a define setup_per_cpu_areas can not be used outside
> of this compilation unit.  Right now this looks to be the case, but if
> something other than init/main.c wanted to use setup_per_cpu_areas we
> would need to make the code an actual function or put the define in a
> header file.
> 
> Since either case should optimize away, maybe we should make it a static
> inline in both cases, since that is the authors original preference ...
> 
> 	Robert Love
> 

Ok, so this patch should be fine then

--- init/main.c Tue Apr 16 06:52:20 2002
+++ init/main.c_new     Tue Apr 16 06:55:17 2002
@@ -272,6 +272,10 @@
 #define smp_init()     do { } while (0)
 #endif

+static inline void setup_per_cpu_areas(void)
+{
+}
+
 #else

 #ifdef __GENERIC_PER_CPU
@@ -297,9 +301,11 @@
        }
 }
 #else
+
 static inline void setup_per_cpu_areas(void)
 {
 }
+
 #endif /* !__GENERIC_PER_CPU */

 /* Called by boot processor to activate the rest. */





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

end of thread, other threads:[~2002-04-16  4:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-15 22:53 [Patch] Compilation error on 2.5.8 Bongani
2002-04-15 22:45 ` Robert Love
2002-04-15 23:34   ` Bongani
2002-04-15 23:24     ` Robert Love
2002-04-16  4:57       ` Bongani
2002-04-16  4:48         ` Robert Love

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