Re: Trying to compile 1.2.13

Tony Nugent (tonyn@sctnugen.ppp.gu.edu.au)
Fri, 16 Feb 1996 13:46:42 +1000


So wrote Dr. Werner Fink <werner@suse.de> on Thu, 15 Feb 1996:

> > I agree. We need to allow 1.2.13 to be compiled as ELF under GCC
> > 2.7.0 onward. GCC 2.7.2 dies while trying to compile include/asm/io.h.
> > The only problem with having Linux 1.2.14 is that Linus is release
> > version 2.0 as soon as all the bugs have been ironed out of 1.3.x.

> > I think this is a great idea. However, I don't have that
> > include/asm/io.h patch with me right now.

> Try this small patch:

... I assume to the 1.2.13 sources...

> -------------------------------------------------------------------
> --- /usr/src/linux/Makefile Wed Aug 16 20:53:26 1995
> +++ linux/Makefile Fri Dec 8 16:19:49 1995
> @@ -12,9 +12,9 @@
> TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
>
> -AS =as
> -LD =ld
> -HOSTCC =gcc -I$(TOPDIR)/include
> -CC =gcc -D__KERNEL__ -I$(TOPDIR)/include
> +AS =/usr/i486-linuxaout/bin/as
> +LD =ld -m i386linux
> +HOSTCC =gcc -b i486-linuxaout -I$(TOPDIR)/include
> +CC =gcc -b i486-linuxaout -D__KERNEL__ -I$(TOPDIR)/include
> MAKE =make
> CPP =$(CC) -E
> AR =ar
> -------------------------------------------------------------------
>
> works for me under ELF :-)

All it does is force the compilation of an a.out kernel on an
elf-capable system. For this reason, it's a useful patch.

The other solution (besides the io.h patches for gcc 2.7.2) is to
patch the 1.2.13 sources with the "slackware" linuxelf patch.

I've attached the io.h patch for gcc-2.7.2 below. Please note that
I've replaced the originally posted patch with a unified diff.

Cheers
Tony
-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-
T.Nugent@sct.gu.edu.au tonyn@sctnugen.ppp.gu.edu.au
Brisbane Queensland Australia
-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-
Things you don't want to hear the computer systems administrator say:
You did WHAT to the floppy???

========8<----insert-crowbar-here------------------------------

Date: Tue, 30 Jan 1996 00:07:43 -0600 (CST)
From: Michael Brennen <mbrennen@fni.com>
Subject: Re: problems compiling 1.2.13...

On Sat, 27 Jan 1996, Logic wrote:

> Having a devil of a time trying to compile 1.2.13 with the following
> patches:
>
> - 1.2.13 elf patch from Slackware
> - a minor kernel/exit.c patch for posixism
> - 1.2.13 quota patch
> - ppp 2.2.0e patches/additions

<clip>

> Anyways, here's the error I get compiling:
>
> gcc -D__KERNEL__ -I/mnt/prime/usr/src/tmp/linux/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -m486 -c -o init/main.o init/main.c
> /mnt/prime/usr/src/tmp/linux/include/asm/io.h: In function `copro_timeout':
> /mnt/prime/usr/src/tmp/linux/include/asm/io.h:82: inconsistent operand constraints in an `asm'
> /mnt/prime/usr/src/tmp/linux/include/asm/io.h:82: inconsistent operand constraints in an `asm'
> /mnt/prime/usr/src/tmp/linux/include/asm/io.h:82: inconsistent operand constraints in an `asm'
> /mnt/prime/usr/src/tmp/linux/include/asm/io.h:82: inconsistent operand constraints in an `asm'
> /mnt/prime/usr/src/tmp/linux/include/asm/io.h: In function `check_fpu':
> /mnt/prime/usr/src/tmp/linux/include/asm/io.h:78: inconsistent operand constraints in an `asm'
> /mnt/prime/usr/src/tmp/linux/include/asm/io.h:82: inconsistent operand constraints in an `asm'
> /mnt/prime/usr/src/tmp/linux/include/asm/io.h:78: inconsistent operand constraints in an `asm'
> /mnt/prime/usr/src/tmp/linux/include/asm/io.h:82: inconsistent operand constraints in an `asm'
> make: *** [init/main.o] Error 1

I resolved this with the patch below. I generated this from a diff with
the 1.3.52 include/asm/io.h file and manually removed all that did not
seem to apply to the 1.2.13 kernel.

Any comments about errors or oversights in the patch are welcome.

Michael

diff -u linux/include/asm/io.h.orig linux/include/asm/io.h
*** linux/include/asm/io.h.orig Mon Aug 15 02:56:19 1994
--- linux/include/asm/io.h Fri Feb 16 13:40:21 1996
@@ -49,21 +49,21 @@

#define __OUT(s,s1,x) \
__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \
-__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "i" (port)); } \
+__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); } \
__OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \
-__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "i" (port)); SLOW_DOWN_IO; }
+__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; }

#define __IN1(s) \
-extern inline unsigned int __in##s(unsigned short port) { unsigned int _v;
+extern inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v;

#define __IN2(s,s1,s2) \
__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"

#define __IN(s,s1,i...) \
__IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \
-__IN1(s##c) __IN2(s,s1,"") : "=a" (_v) : "i" (port) ,##i ); return _v; } \
+__IN1(s##c) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \
__IN1(s##_p) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \
-__IN1(s##c_p) __IN2(s,s1,"") : "=a" (_v) : "i" (port) ,##i ); SLOW_DOWN_IO; return _v; }
+__IN1(s##c_p) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; }

#define __INS(s) \
extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \
@@ -75,9 +75,17 @@
{ __asm__ __volatile__ ("cld ; rep ; outs" #s \
: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }

-__IN(b,"b","0" (0))
-__IN(w,"w","0" (0))
+#define RETURN_TYPE unsigned char
+/* __IN(b,"b","0" (0)) */
+__IN(b,"")
+#undef RETURN_TYPE
+#define RETURN_TYPE unsigned short
+/* __IN(w,"w","0" (0)) */
+__IN(w,"")
+#undef RETURN_TYPE
+#define RETURN_TYPE unsigned int
__IN(l,"")
+#undef RETURN_TYPE

__OUT(b,"b",char)
__OUT(w,"w",short)