From: michael@mercury.cs.mun.ca (Mike Rendell)
Newsgroups: gnu.gcc.bug
Subject: Fix for LINK_SPEC and SIZE_TYPE in config files for mips-riscos5.00
Date: 12 Nov 92 06:38:58 GMT
Distribution: gnu
Organization: GNUs Not Usenet

Environment: Mips M/120 running Riscos 5.00, gcc 2.3.1

The LINK_SPEC in mips-5*.h knows about the `-shared' and `-non_shared'
ld options but doesn't know about `-call_shared'.  `-shared' means
build a shared library object, `-non_shared' means build a staticly
linked executable and `-call_shared' means build a dynamically linked
executable.  The following diffs let gcc know about -call_shared.

The diff for config/mips-5bsd.h also adds a definition for SIZE_TYPE.
This is because, in the bsd43 environment, `size_t' is a signed long,
not the default unsigned long.

By the way, code compiled by gcc 2.3.1 can't make use of shared
libraries because of a bug in Mips's dynamic linker.  The linker
messes with the stack frames of functions, adding and modifying
instructions as necessary.  In the process, it adjusts `move $sp,$fp'
instructions in function epilogues the wrong way.  The result is
that the function returns to a random address (usually causes a
memory fault).


*** config/mips-5.h.orig	Sun Nov  8 11:45:05 1992
--- config/mips-5.h	Sun Nov  8 11:46:20 1992
***************
*** 24,29 ****
  	%{EB} %{!EB: -EB} \
  	%{EL: %e-EL not supported} \
  	%{mips1} %{mips2} %{mips3} %{bestGnum} \
! 	%{shared} %{non_shared} %{!shared: %{!non_shared: -non_shared}}"
  
  #include "mips.h"
--- 24,30 ----
  	%{EB} %{!EB: -EB} \
  	%{EL: %e-EL not supported} \
  	%{mips1} %{mips2} %{mips3} %{bestGnum} \
! 	%{shared} %{call_shared} %{non_shared} \
! 	%{!shared:%{!call_shared:%{!non_shared: -non_shared}}}}"
  
  #include "mips.h"

*** config/mips-5bsd.h.orig	Sun Nov  8 14:43:39 1992
--- config/mips-5bsd.h	Sun Nov  8 14:43:58 1992
***************
*** 37,43 ****
  	%{EB} %{!EB: -EB} \
  	%{EL: %e-EL not supported} \
  	%{mips1} %{mips2} %{mips3} %{bestGnum} \
! 	%{shared} %{non_shared} %{!shared: %{!non_shared: -non_shared}} \
  	-systype /bsd43/ }"
  		    
  #define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc"
--- 37,44 ----
  	%{EB} %{!EB: -EB} \
  	%{EL: %e-EL not supported} \
  	%{mips1} %{mips2} %{mips3} %{bestGnum} \
! 	%{shared} %{call_shared} %{non_shared} \
! 	%{!shared:%{!call_shared:%{!non_shared: -non_shared}}} \
  	-systype /bsd43/ }"
  		    
  #define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc"
***************
*** 52,56 ****
--- 53,60 ----
  /* Override defaults for finding the MIPS tools.  */
  #define MD_STARTFILE_PREFIX "/bsd43/usr/lib/cmplrs/cc/"
  #define MD_EXEC_PREFIX "/bsd43/usr/lib/cmplrs/cc/"
+ 
+ /* This is non-ANSI, but it's whats in /usr/include/bsd43/sys/types.h */
+ #define SIZE_TYPE	"long int"
  
  #include "mips.h"

*** config/mips-5svr4.h.orig	Sun Nov  8 11:45:05 1992
--- config/mips-5svr4.h	Sun Nov  8 11:46:54 1992
***************
*** 37,43 ****
  	%{EB} %{!EB:-EB} \
  	%{EL: %e-EL not supported} \
  	%{mips1} %{mips2} %{mips3} %{bestGnum} \
! 	%{shared} %{non_shared} %{!shared: %{!non_shared: -non_shared}} \
  	-systype /svr4/}"
  		    
  #define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s"
--- 37,44 ----
  	%{EB} %{!EB:-EB} \
  	%{EL: %e-EL not supported} \
  	%{mips1} %{mips2} %{mips3} %{bestGnum} \
! 	%{shared} %{call_shared} %{non_shared} \
! 	%{!shared:%{!call_shared:%{!non_shared: -non_shared}}} \
  	-systype /svr4/}"
  		    
  #define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s"

*** config/mips-5sysv.h.orig	Sun Nov  8 11:45:06 1992
--- config/mips-5sysv.h	Sun Nov  8 11:47:05 1992
***************
*** 37,43 ****
  	%{EB} %{!EB:-EB} \
  	%{EL: %e-EL not supported} \
  	%{mips1} %{mips2} %{mips3} %{bestGnum} \
! 	%{shared} %{non_shared} %{!shared: %{!non_shared: -non_shared}} \
  	-systype /sysv/}"
  		    
  #define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s"
--- 37,44 ----
  	%{EB} %{!EB:-EB} \
  	%{EL: %e-EL not supported} \
  	%{mips1} %{mips2} %{mips3} %{bestGnum} \
! 	%{shared} %{call_shared} %{non_shared} \
! 	%{!shared:%{!call_shared:%{!non_shared: -non_shared}}} \
  	-systype /sysv/}"
  		    
  #define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s"


--
Michael Rendell - Dept. of Comp. Sci., Memorial University of Newfoundland
Newsgroups: gnu.gcc.bug