This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] sparc64-linux multilibs


Hi!

This patch makes -mapp-regs default on sparc64-linux and creates multilibs
if the user wants the app-regs unused by requesting -mno-app-regs or uses a
different code model to the linux default medium low.
That would mean 6 different types of multilibs
(64bit, 64bit no-app-regs, 64bit cmodel != medlow, 
64bit no-appregs + cmodel != medlow, 32bit, 32bit no-app-regs).
That seemed too much for me, so I have modified a little bit genmultilib to
accept a new syntax and now I can have just 4 types of multilibs:
(64bit, 64bit with no-app-regs or cmodel != medlow or both, 32bit, 32bit
no-app-regs).
That's because code compiled with -mno-app-regs -mcmodel=medany is linkable
with any 64bit code, specifically it does not use app registers and can be
compiled into any code model (this is not the issue with libgcc.a because it
is -fPIC, but with other static libraries within GCC).
Example of the new syntax for MULTILIB_OPTIONS I have hacked into
genmultilib looks like this: 
MULTILIB_OPTIONS=m32/m64 mno-app-regs|mcmodel=medany
with the meaning that m32 and m64 are exclusive (as they used to) and the |
means that there is only one directory for the mno-app-regs|mcmodel=medany
option combination, libraries in it will use all options separated by pipes
and any of the options mentioned in the alternative will mean gcc driver
will consider it.
Only one directory in the MULTILIB_DIRNAMES list corresponds to the |
separated option set and using it makes only sense if MULTILIB_DIRNAMES are
specified.
This change required just changing genmultilib, the gcc driver remained
untouched.

1999-08-03  Jakub Jelinek  <jj@ultra.linux.cz>

	* config/sparc/linux64.h (TARGET_DEFAULT): Make -mapp-regs
	default on linux64 again.
	* config/sparc/t-linux64: Add mno-app-regs and non-medlow code
	models for multilibing.
	* longlong.h: Only provide sparc optimized routines for 32bit sparc:
	as gcc is using only DImode routines we don't need to provide TImode
	on sparc64 and including 32bit code for sparc64 clobbers app-regs.
	* genmultilib: Accept | as alternative separator within a set in
	MULTILIB_OPTIONS.

--- ./gcc/config/sparc/linux64.h.jj	Tue Aug  3 08:38:22 1999
+++ ./gcc/config/sparc/linux64.h	Tue Aug  3 17:49:25 1999
@@ -41,7 +41,7 @@ Boston, MA 02111-1307, USA.  */
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT \
   (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \
-   + MASK_STACK_BIAS + MASK_EPILOGUE + MASK_FPU)
+   + MASK_STACK_BIAS + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU)
 #endif
 
 /* Output at beginning of assembler file.  */
--- ./gcc/config/sparc/t-linux64.jj	Wed Dec 16 22:13:42 1998
+++ ./gcc/config/sparc/t-linux64	Tue Aug  3 17:42:51 1999
@@ -1,6 +1,7 @@
-MULTILIB_OPTIONS = m64/m32
-MULTILIB_DIRNAMES = 64 32
-MULTILIB_MATCHES =
+MULTILIB_OPTIONS = m64/m32 mno-app-regs|mcmodel=medany
+MULTILIB_DIRNAMES = 64 32 alt 
+MULTILIB_MATCHES = mcmodel?medany=mcmodel?medmid
+MULTILIB_EXCEPTIONS = *m32/*medany
 
 LIBGCC = stmp-multilib
 INSTALL_LIBGCC = install-multilib
--- ./gcc/longlong.h.jj	Wed Jan  6 21:44:39 1999
+++ ./gcc/longlong.h	Tue Aug  3 15:25:07 1999
@@ -1,5 +1,5 @@
 /* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
-   Copyright (C) 1991, 92, 94, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1991, 92, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
 
    This definition file is free software; you can redistribute it
    and/or modify it under the terms of the GNU General Public
@@ -885,7 +885,8 @@ UDItype __umulsidi3 (USItype, USItype);
   } while (0)
 #endif
 
-#if defined (__sparc__)
+#if defined (__sparc__) && !defined (__sparc_v9__) && 			\
+   !defined (__arch64__) && !defined (__sparcv9)
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
   __asm__ ("addcc %r4,%5,%1
 	addx %r2,%3,%0"							\
@@ -1068,7 +1069,7 @@ UDItype __umulsidi3 (USItype, USItype);
 #define UDIV_TIME (3+7*32)	/* 7 instructions/iteration. 32 iterations. */
 #endif /* __sparclite__ */
 #endif /* __sparc_v8__ */
-#endif /* __sparc__ */
+#endif /* __sparc__ 32bit */
 
 #if defined (__vax__)
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
--- ./gcc/genmultilib.jj	Wed Dec 16 21:56:22 1998
+++ ./gcc/genmultilib	Tue Aug  3 17:40:46 1999
@@ -1,6 +1,6 @@
 #!/bin/sh 
 # Generates multilib.h.
-#   Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+#   Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
 
 #This file is part of GNU CC.
 
@@ -25,9 +25,14 @@
 
 # The first argument is a list of sets of options.  The elements in
 # the list are separated by spaces.  Within an element, the options
-# are separated by slashes.  No leading dash is used on the options.
-# Each option in a set is mutually incompatible with all other options
+# are separated by slashes or pipes.  No leading dash is used on the
+# options.
+# Each option in a set separated by slashes is mutually incompatible
+# with all other options
 # in the set.
+# Each option in a set separated by pipes will be used for the library
+# compilation and any of the options in the set will be sufficient
+# for it to be triggered.
 
 # The optional second argument is a list of subdirectory names.  If
 # the second argument is non-empty, there must be as many elements in
@@ -106,13 +111,23 @@ cat >tmpmultilib <<\EOF
 if [ "$#" != "0" ]; then
   first=$1
   shift
-  for opt in `echo $first | sed -e 's|/| |'g`; do
-    echo ${initial}${opt}/
-  done
-  ./tmpmultilib $@
-  for opt in `echo $first | sed -e 's|/| |'g`; do
-    initial="${initial}${opt}/" ./tmpmultilib $@
-  done
+  case "$first" in
+  *\|*)
+    all=${initial}`echo $first | sed -e 's_|_/_'g`
+    first=`echo $first | sed -e 's_|_ _'g`
+    echo ${all}/
+    initial="${initial}${all}/" ./tmpmultilib $@
+    ./tmpmultilib $first $@ | grep -v "^${all}"
+    ;;
+  *)
+    for opt in `echo $first | sed -e 's|/| |'g`; do
+      echo ${initial}${opt}/
+    done
+    ./tmpmultilib $@
+    for opt in `echo $first | sed -e 's|/| |'g`; do
+      initial="${initial}${opt}/" ./tmpmultilib $@
+    done
+  esac
 fi
 EOF
 chmod +x tmpmultilib
@@ -155,10 +170,17 @@ if [ -n "${dirnames}" ]; then
   set x ${dirnames}
   shift
   for set in ${options}; do
-    for opt in `echo ${set} | sed -e 's|/| |'g`; do
-      if [ "$1" != "${opt}" ]; then
-        todirnames="${todirnames} -e s|/${opt}/|/${1}/|g"
-      fi
+    for opts in `echo ${set} | sed -e 's|/| |'g`; do
+      patt="/"
+      for opt in `echo ${opts} | sed -e 's_|_ _'g`; do
+        if [ "$1" != "${opt}" ]; then
+          todirnames="${todirnames} -e s|/${opt}/|/${1}/|g"
+	  patt="${patt}${1}/"
+	  if [ "${patt}" != "/${1}/" ]; then
+	    todirnames="${todirnames} -e s|${patt}|/${1}/|g"
+          fi
+        fi
+      done
       shift
     done
   done
@@ -198,7 +220,7 @@ chmod +x tmpmultilib2
 # Start with the current directory, which includes only negations.
 optout=
 for set in ${options}; do
-  for opt in `echo ${set} | sed -e 's|/| |'g`; do
+  for opt in `echo ${set} | sed -e 's_[/|]_ _g'`; do
     optout="${optout} !${opt}"
   done
 done
@@ -223,7 +245,7 @@ for combo in ${combinations}; do
   # present, and negate each option that is not present.
   optout=
   for set in ${options}; do
-    setopts=`echo ${set} | sed -e 's|/| |g'`
+    setopts=`echo ${set} | sed -e 's_[/|]_ _g'`
     for opt in ${setopts}; do
       if expr "${combo} " : ".*/${opt}/.*" > /dev/null; then
 	optout="${optout} ${opt}"
@@ -254,7 +276,7 @@ for match in ${matches}; do
   echo "\"${r} ${l};\","
 done
 for set in ${options}; do
-  for opt in `echo ${set} | sed -e 's|/| |'g`; do
+  for opt in `echo ${set} | sed -e 's_[/|]_ _'g`; do
     echo "\"${opt} ${opt};\","
   done
 done

Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux  |  http://ultra.linux.cz/  |  http://ultra.penguin.cz/
Linux version 2.3.13 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]