] From:	CRDGW2::CRDGW2::MRGATE::"SMTP::PREP.AI.MIT.EDU::OWNER-INFO-GCC" 12-SEP-1990 19:07:28.07  To:	MRGATE::"ARISIA::EVERHART" CC:	$ Subj:	Building gcc 1.37.1 with Vax C  * Received:  by crdgw1.ge.com (5.57/GE 1.73)) 	 id AA17233; Wed, 12 Sep 90 18:46:39 EDT R Received: by life.ai.mit.edu (4.1/AI-4.10) id AA17524; Tue, 11 Sep 90 11:54:49 EDT/ Return-Path: <info-gcc-request@prep.ai.mit.edu> n Received: from tut.cis.ohio-state.edu by life.ai.mit.edu (4.1/AI-4.10) id AA17030; Tue, 11 Sep 90 11:43:20 EDT6 Received: by tut.cis.ohio-state.edu (5.61-kk/5.900605)* 	id AA00702; Tue, 11 Sep 90 11:30:24 -0400< Received: from USENET by tut.cis.ohio-state.edu with netnews8 	for info-gcc@prep.ai.mit.edu (info-gcc@prep.ai.mit.edu)> 	(contact usenet@tut.cis.ohio-state.edu if you have questions) Date: 11 Sep 90 14:07:21 GMT: From: news@operations.dccs.upenn.edu  (USENET News System)( Organization: University of Pennsylvania' Subject: Building gcc 1.37.1 with Vax C % Message-Id: <29387@netnews.upenn.edu> 1 References: <9009102236.AA15872@wubios.wustl.edu> ( Sender: info-gcc-request@prep.ai.mit.edu To: info-gcc@prep.ai.mit.edu  + during it; hopefully they'll come in handy.    :  To build the new gcc-cpp and gcc-cc1 that come with Gnu C< version 1.37.1 with Vax C and NOT a previous version of gcc, do the following:     I - Building gcc-cpp       A - Modify cccp.c         1 - Replace    	#include <sys/types.h>  	#include <sys/stat.h>           with     	#ifndef VMS 	#include <sys/types.h>  	#include <sys/stat.h> 	#else 	#include <types.h>  	#include <stat.h> 	#endif    >      2 - In the VMS-specific section (has perror.h etc in it), add the following:   0 	#include <descrip.h>	/* for dsc$descriptor_s *// 	#include <string.h>	/* for strchr & strrchr */  	#define index	strchr  	#define rindex	strrchr    /      3 - You have to replace all occurences of:    ! 	extern char *index(), *rindex();    B  as well as any where they're separated (e.g. extern char *index()C  by itself or extern char *rindex() by itself), with the following:     	#ifndef VMS1 	extern char *index();	/* or whatever was here */  	#endif    B  There's a total of three: one in main(), one in do_include(), and)  one in hack_vms_include_specification().    A    B - You have to have alloca.mar for cccp.c; it was distributed A  with vmsgcc1.34; it's also in the bison distribution. (both 1.03 
  and 1.06)   B    C - After you've compiled alloca.mar (MACRO ALLOCA.MAR), follow@  the instructions at the top of MAKE-CC1.COM (namely, change the4  CC := line to say cc/noopt instead of gcc, take theF  cc1_options="-mpcc-alignment" part out of the CFLAGS line, and change  the LIBS line to say:   . 	$ LIBS :=       alloca,sys$share:vaxcrtl/libr   <    D - Since it doesn't come with the distribution, you have=  to generate cexp_tab.c yourself, either with bison on either C  a Vax or a Unix box, or yacc in Unix. (@make below will die if you 6  don't have bison on your Vax or don't have this file)       E - Type:    	@make   C  and watch it hum. It should go through okay; it'll die on the LINK  line, but don't worry about it.    %    F - Now link the whole thing with:    3 	link /nomap/exe=gcc-cpp cccp,cexp,version,alloca,-  	 sys$share:vaxcrtl/libr   E    G - You should be screaming for joy right now; if you're not, then  give up on life. <snicker>       II - Building gcc-cc1    /    A - Change MAKE-CC1.COM to contain the line:    ) 	$ libs :== sys$share:vaxcrtl/libr,alloca    * Yep, you have to have alloca.obj here too.       B - Modify toplev.c:          1 - Replace    	#include <sys/types.h>  	#include <sys/stat.h>    	with     	#ifndef VMS 	#include <sys/types.h>  	#include <sys/stat.h> 	#else 	#include <types.h>  	#include <stat.h> 	#endif     (You'll see this again.)         2 - Do:   & Repl:	rtx_equal_function_value_matters  With:	rtx_equ_func_value_matters	 Num:	once    9  This is cuz you can't have a name over 31 chars with the 8 Vax C compiler; and yep you guessed it this is over that3 limit. You're gonna be doing this a few more times.        C - Modify gcc.c:   :      1 - This is optional, since you never compile it (I'm working on that):     	Replace    	#include <stdio.h>  	#include <sys/types.h>  	#include <signal.h> 	#include <sys/file.h>    	with     	#include <stdio.h>  	#include <signal.h> 	#ifdef VMS  	#include <types.h>  	#include <file.h> 	#else 	#include <sys/types.h>  	#include <sys/file.h> 	#endif    =    D - Modify c-parse_tab.c (if this isn't there, you'll have ! to create it with bison or yacc):    * Repl:	expand_start_loop_continue_elsewhere% With:	expand_startloop_cont_elsewhere 
 Num:	twice       E - Modify tree.h:    * Repl:	expand_start_loop_continue_elsewhere% With:	expand_startloop_cont_elsewhere 	 Num:	once        F - Modify stmt.c:    * Repl:	expand_start_loop_continue_elsewhere% With:	expand_startloop_cont_elsewhere 
 Num:	twice   ) Repl:	current_function_returns_pcc_struct  With:	cur_func_ret_pcc_struct 	 Num:	nine    & Repl:	current_function_returns_pointer With:	cur_func_ret_ptr Num:	2   ( Repl:	current_function_pretend_args_size  With:	cur_func_pretend_args_size Num:	3       G - Modify rtanal.c:    & Repl:	rtx_equal_function_value_matters! With:	rtx_equ_func_values_matters 
 Num:	twice       H - Modify output.h:    ) Repl:	current_function_returns_pcc_struct  With:	cur_func_ret_pcc_struct 	 Num:	once    ' Repl: 	current_function_returns_pointer  With:	cur_func_ret_ptr	 Num:	once    ( Repl:	current_function_pretend_args_size  With:	cur_func_pretend_args_size	 Num:	once        I - Modify tree.def:      Change the line that reads:   - 	DEFTREECODE (FILE_TYPE, "file_type", "t", 0)      to:    	#ifdef VMS 1 	DEFTREECODE (FILE_TYPE_GNU, "file_type", "t", 0)  	#else- 	DEFTREECODE (FILE_TYPE, "file_type", "t", 0)  	#endif    5  This is cuz FILE_TYPE is defined in stdio.h as being 4 struct _iobuf *, which totally screws everything up.       J - Modify expr.c:      Change the line that reads:    	if (code == FILE_TYPE)      to:    	#ifdef VMS  	if (code == FILE_TYPE_GNU)  	#else 	if (code == FILE_TYPE)  	#endif        K - Modify expmed.c:      Change the line that reads:   /  trymode && GET_MODE_SIZE (trymode) <= maxsize;      to:   8  (trymode != 0) && (GET_MODE_SIZE (trymode) <= maxsize);   ;  Enclosing the second half of the and in parenthesis may be 8 overkill. By the time I thought of it it was too late to8 change it (read: I didn't feel like going back), but you may want to give it a try.       L - Modify symout.c:    7  Change the line that has #include <stddef.h> on it to:     	#ifndef VMS 	#include <stddef.h> 	#else 	#define NULL	(void *) 0 	#endif        M - Modify insn-emit.c:   9  Line #1011 (in mine) is a 376-character long line that's 8 one HUGE return (it calls a function a few zillion times: embedded upon each other). This is a tad too big for Vax C; to chew; try cutting it down to a few lines. I made it look 
 like this:    rtx 3 gen_casesi (operand0, operand1, operand2, operand3)       rtx operand0;      rtx operand1;      rtx operand2;      rtx operand3; { (   return gen_rtx (SET, VOIDmode, pc_rtx,#    gen_rtx (IF_THEN_ELSE, VOIDmode,      gen_rtx (LE, VOIDmode,1      gen_rtx (MINUS, SImode, operand0, operand1),      operand2),     gen_rtx (PLUS, SImode,"      gen_rtx (SIGN_EXTEND, SImode,       gen_rtx (MEM, HImode, %        gen_rtx (PLUS, SImode, pc_rtx, 7         gen_rtx (MINUS, SImode, operand0, operand1)))), ,      gen_rtx (LABEL_REF, SImode, operand3)),    pc_rtx)); }      Kinda smacks of lisp, no?       N - Modify final.c:     Change the line that reads:    	rtx final_sequence;     to:    	#ifndef VMS 	rtx final_sequence; 	#endif    2  This is cuz rtx final_sequence already appears in. output.h, and Vax C screams when it sees this.   6    O - You have to have alloca(), bcopy(), bcmp(), and7 bzero(); all are in the VMS Gcc 1.34 distribution; only : bcopy() is in the bison distribution. Since they're pretty< short, I'm gonna include 'em here. These were sent under the Gnu public license.P  .  alloca.mar:  -3         .PSECT  $CODE,LONG,PIC,REL,SHR,EXE,RD,NOWRTI         .ENTRY  ALLOCA,^M<>l         SUBL2   4(AP),SP         MOVL    16(FP),R1.         MOVQ    8(FP),AP         BICL2   #3,SP1         ADDL2   #28,SP         MOVL    SP,R0/         JMP     (R1)            .END  9  bcopy.mar:P  :3         .PSECT  $CODE,LONG,PIC,REL,SHR,EXE,RD,NOWRTt 	; bcopy(from, to, size)(         .ENTRY  BCOPY,^M<R2,R3,R4,R5,R6>         MOVL    4(AP),R1         MOVL    8(AP),R3         MOVL    12(AP),R60         CMPL    R1,R315         BGTR    2$              ; NORMAL FORWARD CASEs@         BLSS    3$              ; OVERLAPPING, MUST DO BACKWARDS6         RET                     ; EQUAL, NOTHING TO DO 1$:	SUBL2   R0,R6u         MOVC3   R0,(R1),(R3) 2$:	MOVZWL  #65535,R0e         CMPL    R6,R0          BGTR    1$         MOVC3   R6,(R1),(R3)         RET  3$:	ADDL2   R6,R1c         ADDL2   R6,R3e         MOVZWL  #65535,R0e         BRW     5$ 4$:	SUBL2   R0,R67         SUBL2   R0,R1e         SUBL2   R0,R3p         MOVC3   R0,(R1),(R3)         MOVZWL  #65535,R0;         SUBL2   R0,R1          SUBL2   R0,R3l 5$:	CMPL    R6,R0n         BGTR    4$         SUBL2   R6,R17         SUBL2   R6,R3          MOVC3   R6,(R1),(R3)  f
        RET            .END  c
  bcmp.mar:  M3         .PSECT  $CODE,LONG,PIC,REL,SHR,EXE,RD,NOWRTs 	; bcmp(s1, s2, n)$         .ENTRY  BCMP,^M<R2,R3,R4,R5>         MOVL    4(AP),R1         MOVL    8(AP),R3         MOVL    12(AP),R4d 1$:	MOVZWL  #65535,R0          CMPL    R4,R0          BLEQ    2$         SUBL2   R0,R4e         CMPC3   R0,(R1),(R3)         BEQL    1$         ADDL2   R4,R0d         RET_ 2$:	CMPC3   R4,(R1),(R3)         RETr  s         .END  i  i  bzero.mar:   e3         .PSECT  $CODE,LONG,PIC,REL,SHR,EXE,RD,NOWRTe 	; bzero(ptr, size) %         .ENTRY  BZERO,^M<R2,R3,R4,R5>          MOVL    4(AP),R3         BRB     2$ 1$:	SUBL2   R0,8(AP)"         MOVC5   #0,(R3),#0,R0,(R3) 2$:	MOVZWL  #65535,R0e         CMPL    8(AP),R0         BGTR    1$%         MOVC5   #0,(R3),#0,8(AP),(R3)#         RETT  e         .END  e?    P - On the last lines (where it's got all of the link shit),u change it so it reads:    	...blahblahblah... / 	...blahblah,insn-extract,insn-output,obstack,-  	integrate,caller-save,- 	bcopy,bcmp,bzeroo 	$!o  1:  So now it'll link the bcopy, bcmp, and bzero routines in.  M;    Q - You should be screaming for joy right now; if you'reED not, then give up on life again. Hey, I don't get paid for my humor.   0    R - Finally, you have to use old versions of:  t 		GCC.EXE		GCC-AS.EXEn 		GCC.COM		GCC.CLD 		GCCLIB.OLB  BC  to make the package work properly. I've only been able to make the B  new preprocessors make properly; since it wasn't even in the makeC  files that came with it, I don't think gcc.exe 1.37.1 was intendedi&  to be built for the Vax .. we'll see.  vH  In case you're wondering, I could never get vmsgcc134 to work properly;! that's why I did this with Vax C.g  hC  Good luck! This only worked under 5.3-1 (and the latest version of E Vax C...3.0? 3.1?), and isn't guaranteed in any way shape or form. IfpF you have stumbling blocks and think I may have come upon it during all= of this, feel free to mail me at kehoe@scotty.dccs.upenn.edu.e    --, Brendan Kehoe | Soon: brendan@cs.widener.edu@ For now: kehoe@scotty.dccs.upenn.edu | Or: bkehoe@widener.bitnet1      Last resort: brendan.kehoe@cyber.widener.eduh, Brendan Kehoe | Soon: brendan@cs.widener.edu@ For now: kehoe@scotty.dccs.upenn.edu | Or: bkehoe@widener.bitnet, Last resort: brendan.kehoe@cyber.widener.edu