PATCH: Linux/MIPS support - Mailing list pgsql-ports

From Ralf Baechle
Subject PATCH: Linux/MIPS support
Date
Msg-id 20001021232826.A2574@bacchus.dhis.org
Whole thread Raw
Responses Re: PATCH: Linux/MIPS support  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-ports
Below a patch relative to Postgress 6.5.3 to fix the Linux/MIPS support.
It does:

 - update the Linux/MIPS entries in src/template/.similar
 - changes the compilation flags in src/template/linux_mips:
   - Don't use -mips2, this code model isn't supported on all processors, so
     it's a bad choice for a default.  Aside the performance gain is very
     small.
   - No special compilation flags necessary for MIPS ELF systems, so
     delete -fpic.
 - removal of -mips2 affects the tas function in s_lock.c.  I solved the
   problem by conditionally putting the assembler into MIPS 2 mode only for
   Linux.  For MIPS I machines the kernel emulation for these instruction
   then does the job.  This needs to be a conditional since we cannot rely
   on the assembler properly supporting .set mipsX; Linux's assembler however
   does properly.

A further problem when compiling with glibc 2.1.94 is that the file
src/backend/port/inet_aton.h redeclares the system function inet_aton().
Sorry, I don't have a patch for this problem.

Please apply,

  Ralf

diff -urN postgresql-6.5.3.orig/src/backend/storage/buffer/s_lock.c
postgresql-6.5.3/src/backend/storage/buffer/s_lock.c
--- postgresql-6.5.3.orig/src/backend/storage/buffer/s_lock.c    Sun Jun  6 22:19:35 1999
+++ postgresql-6.5.3/src/backend/storage/buffer/s_lock.c    Sat Oct 21 20:35:08 2000
@@ -147,8 +147,11 @@
 static void
 tas_dummy()
 {
-    __asm__("        \n\
-.global    tas            \n\
+    __asm__(
+#ifdef __linux__
+"    .set    mips2        \n"
+#endif
+".global    tas        \n\
 tas:                \n\
     .frame    $sp, 0, $31    \n\
     ll    $14, 0($4)    \n\
@@ -161,8 +164,11 @@
     j       $31        \n\
 fail:                \n\
     li    $2, 1        \n\
-    j       $31        \n\
-    ");
+    j       $31        \n"
+#ifdef __linux__
+"    .set    mips2        \n"
+#endif
+    );
 }

 #endif     /* __mips */
diff -urN postgresql-6.5.3.orig/src/template/.similar postgresql-6.5.3/src/template/.similar
--- postgresql-6.5.3.orig/src/template/.similar    Sat Oct 21 19:22:22 2000
+++ postgresql-6.5.3/src/template/.similar    Sat Oct 21 20:04:26 2000
@@ -33,6 +33,6 @@
 sparc-sun-sunos4=sunos4_gcc
 sparc-sun-sunos5=solaris_sparc_gcc
 sparc-unknown-linux-gnu=linux_sparc
-mips-pc-linux-gnu=linux_mips
+mips-unknown-linux-gnu=linux_mips
 mipsel-unknown-linux-gnu=linux_mips
 arm-unknown-linux-gnu=linux_arm
diff -urN postgresql-6.5.3.orig/src/template/linux_mips postgresql-6.5.3/src/template/linux_mips
--- postgresql-6.5.3.orig/src/template/linux_mips    Fri Dec 18 18:25:41 1998
+++ postgresql-6.5.3/src/template/linux_mips    Sat Oct 21 20:04:26 2000
@@ -1,6 +1,6 @@
 AROPT:crs
-CFLAGS:-O2 -mips2
-SHARED_LIB:-fpic
+CFLAGS:-O2
+SHARED_LIB:
 ALL:
 SRCH_INC:
 SRCH_LIB:

pgsql-ports by date:

Previous
From: Joerg Hessdoerfer
Date:
Subject: Re: great work!
Next
From: Bruce Momjian
Date:
Subject: Re: PATCH: Linux/MIPS support