Skip to contentSkip to conversation

gcc4 compile fixes

PATCH Dan Kegel 2 participants 4 messages Mar 19, 2005 – Apr 4, 2005

lore
Share & tools
lore

Dan Kegel

author
#0 lore raw

Howdy all. I'm trying to bring up gcc-4.0 toolchains using the headers from linux-2.6.11.3, and as a sanity check, I'm trying to build ppc750 and ppc970 kernels, too.

I'm finding things here and there that need patching to let the build finish. For instance:

In file included from include/asm/setup.h:8,

                 from include/asm/machdep.h:8,
                 from include/asm/irq.h:6,
                 from include/asm/hardirq.h:8,
                 from include/linux/hardirq.h:6,
                 from include/asm-generic/local.h:6,
                 from include/asm/local.h:4,
                 from include/linux/module.h:21,
                 from init/main.c:16:

include/asm-m68k/setup.h:365: error: array type has incomplete element type

(This pops up because asm-ppc/setup.h just includes asm-m68k/setup.h.)

That's a garden-variety 'used before defined' problem, fixed thus:

include/asm-m68k/setup.h Fri Mar 18 13:48:14 2005 renamed from include/asm-m68k/setup.h.old Fri Mar 18 13:48:03 2005 +2 -1
@@ -362,12 +362,13 @@
 #ifndef __ASSEMBLY__
 extern int m68k_num_memory;            /* # of memory blocks found (and used) */
 extern int m68k_realnum_memory;                /* real # of memory blocks found */
-extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
 
 struct mem_info {
        unsigned long addr;             /* physical address of memory chunk */
        unsigned long size;             /* length of memory chunk (in bytes) */
 };
+
+extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
 #endif
 
 #endif /* __KERNEL__ */

--- snip ---

Ditto for the next one:

In file included from include/asm/current.h:4,

                 from include/linux/wait.h:27,
                 from include/asm/semaphore.h:15,
                 from include/linux/sched.h:19,
                 from arch/ppc64/kernel/asm-offsets.c:18:

include/asm/paca.h:25: error: array type has incomplete element type make[1]: *** [arch/ppc64/kernel/asm-offsets.s] Error 1

include/asm-ppc64/paca.h Fri Mar 18 13:24:04 2005 renamed from include/asm-ppc64/paca.h.old Fri Mar 18 13:23:40 2005 +2 -1
@@ -22,7 +22,6 @@
 #include       <asm/iSeries/ItLpRegSave.h>
 #include       <asm/mmu.h>
 
-extern struct paca_struct paca[];
 register struct paca_struct *local_paca asm("r13");
 #define get_paca()     local_paca
 
@@ -114,5 +113,7 @@
        struct ItLpRegSave reg_save;
 #endif
 };
+
+extern struct paca_struct paca[];
 
 #endif /* _PPC64_PACA_H */

--- snip ---

If somebody else has already fixed all of these, I'd rather
just use their sources. So... shall I keep on patching
and posting, or are these already fixed somewhere?

Thanks,
Dan

Signature · 1 line
Trying to get a job as a c++ developer?  See http://kegel.com/academy/getting-hired.html
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 3 lines · Dan Kegel

Howdy all. I'm trying to bring up gcc-4.0 toolchains using the headers from linux-2.6.11.3, and as a sanity check, I'm trying to build ppc750 and ppc970 kernels, too.

i have tried with vanilla 2.6.11.6 now and compiling for ppc604 still fails with the errors you described. they go away with your suggested fixes (only had to modify the linenumbers, diff attached, apply with -p0)

oh, not that the kernel compiles now - it seems it just overcame a build error out of many :->

now it [1] fails with:

In file included from arch/ppc/kernel/time.c:68:
include/asm/time.h:61: warning: type qualifiers ignored on function return type
arch/ppc/kernel/time.c:92: error: static declaration of 'time_offset' follows non-static declaration
include/linux/timex.h:236: error: previous declaration of 'time_offset' was here
make[1]: *** [arch/ppc/kernel/time.o] Error 1
make: *** [arch/ppc/kernel] Error 2

thank you,
Christian.

[1] building a ppc604(PReP) kernel on i386:
powerpc-604-linux-gnu-gcc (GCC) 4.0.0 20050305 (prerelease) GNU ld version 2.15
Supported emulations:
elf32ppclinux
elf32ppc
elf32ppcsim
- --
BOFH excuse #345:

Having to manually track the satellite.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCUJ25C/PVm5+NVoYRArBVAKDU+Zbg2dYxXksrN7eK5jpx+kzmpgCdGgHY kxED/GRoU4+1c/NrrGXn4D8=
=hn4d
-----END PGP SIGNATURE-----

asm-ppc64/paca.h renamed from asm-ppc64/paca.h.orig +2 -1
@@ -22,7 +22,6 @@
 #include	<asm/iSeries/ItLpRegSave.h>
 #include	<asm/mmu.h>
 
-extern struct paca_struct paca[];
 register struct paca_struct *local_paca asm("r13");
 #define get_paca()	local_paca
 
@@ -115,4 +114,6 @@
 #endif
 };
 
+extern struct paca_struct paca[];
+
 #endif /* _PPC64_PACA_H */
asm-m68k/setup.h renamed from asm-m68k/setup.h.orig +2 -1
@@ -362,12 +362,13 @@
 #ifndef __ASSEMBLY__
 extern int m68k_num_memory;		/* # of memory blocks found (and used) */
 extern int m68k_realnum_memory;		/* real # of memory blocks found */
-extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
 
 struct mem_info {
 	unsigned long addr;		/* physical address of memory chunk */
 	unsigned long size;		/* length of memory chunk (in bytes) */
 };
+
+extern struct mem_info m68k_memory[NUM_MEMINFO]; /* memory description */
 #endif
 
 #endif /* __KERNEL__ */
#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

replying to myself:

Quoted 5 lines · Christian

now it [1] fails with:

In file included from arch/ppc/kernel/time.c:68:
include/asm/time.h:61: warning: type qualifiers ignored on function return type

[...]

..and there were other error messages too. not knowing a *bit* of C, i was able to do minor alterations which i deduced from gcc's error messages. now compiling for ppc604 (PReP) with gcc4 succeeds.

thank you for your concern,
Christian.
- --
BOFH excuse #403:

Sysadmin didn't hear pager go off due to loud music from bar-room speakers. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCUUfEC/PVm5+NVoYRAiMYAKCVru912jky9ctrnAhBe+ukymReQgCg9z6Y YSNKwksGyXiDKgxpvGhO1wM=
=WSll
-----END PGP SIGNATURE-----

arch/ppc/syslib/open_pic_defs.h renamed from arch/ppc/syslib/open_pic_defs.h.orig +1 -1
@@ -172,7 +172,7 @@
     OpenPIC_Processor Processor[OPENPIC_MAX_PROCESSORS];
 };
 
-extern volatile struct OpenPIC __iomem *OpenPIC;
+static volatile struct OpenPIC __iomem *OpenPIC;
 
 
     /*
arch/ppc/kernel/time.c renamed from arch/ppc/kernel/time.c.orig +1 -1
@@ -89,7 +89,7 @@
 
 extern unsigned long wall_jiffies;
 
-static long time_offset;
+extern long time_offset;
 
 DEFINE_SPINLOCK(rtc_lock);
 
include/asm-ppc/time.h renamed from include/asm-ppc/time.h.orig +2 -2
@@ -58,7 +58,7 @@
 /* Accessor functions for the timebase (RTC on 601) registers. */
 /* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
 #ifdef CONFIG_6xx
-extern __inline__ int const __USE_RTC(void) {
+static __inline__ int const __USE_RTC(void) {
 	return (mfspr(SPRN_PVR)>>16) == 1;
 }
 #else
@@ -92,7 +92,7 @@
 	mtspr(SPRN_TBWL, lower);
 }
 
-extern __inline__ unsigned long get_rtcl(void) {
+static __inline__ unsigned long get_rtcl(void) {
 	unsigned long rtcl;
 	asm volatile("mfrtcl %0" : "=r" (rtcl));
 	return rtcl;
include/asm-ppc/prom.h renamed from include/asm-ppc/prom.h.orig +2 -2
@@ -13,8 +13,8 @@
 typedef void *phandle;
 typedef void *ihandle;
 
-extern char *prom_display_paths[];
-extern unsigned int prom_num_displays;
+static char *prom_display_paths[];
+static unsigned int prom_num_displays;
 
 struct address_range {
 	unsigned int space;
author
#3 lore raw
Quoted 13 lines · Christian

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

replying to myself:

Quoted 5 lines · Christian

now it [1] fails with:

In file included from arch/ppc/kernel/time.c:68:
include/asm/time.h:61: warning: type qualifiers ignored on function return type

Quoted 5 lines

[...]

..and there were other error messages too. not knowing a *bit* of C, i was able to do minor alterations which i deduced from gcc's error messages. now compiling for ppc604 (PReP) with gcc4 succeeds.

Thanks for the report and the patch.
Parts of that patch look like ones I've already collected at:
http://www.kegel.com/crosstool/crosstool-0.30/patches/linux-2.6.11.3/
Here are the patches I have so far:
kaz-types.patch linux-2.6.11-allow-gcc-4.0-asm-i386.patch linux-2.6.11-allow-gcc-4.0-asm-m68k.patch linux-2.6.11-allow-gcc-4.0-asm-ppc64.patch linux-2.6.11-allow-gcc-4.0-asm-x86_64.patch linux-2.6.11-allow-gcc-4.0-i2c.patch linux-2.6.11-allow-gcc-4.0-ppc-mikpe.patch

In particular,
http://www.kegel.com/crosstool/crosstool-0.30/patches/linux-2.6.11.3/linux-2.6.11-allow-gcc-4.0-ppc-mikpe.patch
covers some of what you found.

Maybe if I apply your first patch, I'll make it all the way through.

Thanks,
Dan

Signature · 1 line
Trying to get a job as a c++ developer?  See http://kegel.com/academy/getting-hired.html