Compilation error on 2.5.8
PATCH 1/1 Compilation error on 2.5.8
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.
main.c_new Tue Apr 16 00:32:51 2002 renamed from main.c Tue Apr 16 00:33:04 2002 +2 -0
@@ -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
Quoted 9 lines · Bongani
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,
init/main.c +2 -0
@@ -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
Quoted 20 lines · Robert Love
Quoted 9 lines · Bongani
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_areasto nothing whenCONFIG_SMPis not set so as not to have #ifdefs in the code itself ... for example,diff -urN
linux-2.5.8/init/main.clinux/init/main.c
init/main.c line 279
Quoted 8 lines
init/main.c +2
-0@@ -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 ?
main.c_new Tue Apr 16 01:30:13 2002 renamed from main.c Tue Apr 16 01:31:29 2002 +5 -3
@@ -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. */
main.c_new Tue Apr 16 01:30:13 2002 line 304
Quoted 8 lines · Bongani
Does this also look cleaner ?
main.c_new Tue Apr 16 01:30:13 2002 renamed from main.c Tue Apr 16 01:31:29 2002 +3
-3-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
Quoted 19 lines · Robert Love
Review
Quoted 8 lines · Bongani
Does this also look cleaner ?
(quoted diff) +3
-3-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_areascan not be used outside of this compilation unit. Right now this looks to be the case, but if something other thaninit/main.cwanted to usesetup_per_cpu_areaswe would need to make the code an actual function or put the define in a header file.
Quoted 5 lines
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
main.c_new Tue Apr 16 06:55:17 2002 renamed from main.c Tue Apr 16 06:52:20 2002 +6 -0
@@ -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. */
Quoted 1 line · Bongani
Ok, so this patch should be fine then
I likee.
Quoted 15 lines
main.c_new Tue Apr 16 06:55:17 2002 renamed from main.c Tue Apr 16 06:52:20 2002 +4
-0@@ -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 @@ }
main.c_new Tue Apr 16 06:55:17 2002 line 311
Quoted 10 lines
main.c_new Tue Apr 16 06:55:17 2002 renamed from main.c Tue Apr 16 06:52:20 2002 +2
-0} #else + static inline void setup_per_cpu_areas(void) { } + #endif /* !__GENERIC_PER_CPU */ /* Called by boot processor to activate the rest. */
Robert Love