alpha.c (vmskrunch): Delete

* alpha/alpha.c (vmskrunch): Delete
        * alpha/vms.h (ENCODE_SECTION_INFO, ASM_DECLARE_FUNCTION_NAME): Delete.

        * make-l2.com: Support openVMS/Alpha.

        * vmsconfig.com: Fix to work on openVMS/Alpha and openVMS/VAX.

Some patches from Klaus.

From-SVN: r16097
This commit is contained in:
Jeff Law 1997-10-20 02:11:49 -06:00
parent 7d4f2e6c2a
commit c12894e1c3
4 changed files with 61 additions and 212 deletions

View file

@ -1992,150 +1992,6 @@ add_long_const (file, c, in_reg, out_reg, temp_reg)
#if OPEN_VMS
/*
Quick and dirty vmskrunch routine to ensure symbols are within the
64 bytes limit imposed by VMS.
This is written specifically for GNAT, and may not work for C++.
This routine duplicates every symbol passed to it whether it is too
long or not, which is a waste of space, fix later.
*/
#include <string.h>
char*
vmskrunch (name)
char *name;
{
char *foo;
int max = 60; /* Allow for the ..xx extension */
int len, tlen;
if (name[0] == '*')
return (&name[1]);
len = tlen = strlen (name);
foo = xstrdup (name);
/* Don't muck with the ..xx extenstion */
if ((foo [tlen-4] == '.') && (foo [tlen-3] == '.'))
{
max = max + 4;
if (tlen > max)
{
foo [tlen-4] = 0;
len = len - 4;
max = max - 4;
}
}
if (len > max)
{
char *bar;
int i, j, slen, nlen, xlen, chopchar;
nlen = len;
/* Change all _ and . characters to spaces, if thats enough then quit.
For example: "foobar__foo__bar" becomes "foobar foo bar" */
for (i = 0; bar = index (foo, '_'); i++)
*bar = ' ';
nlen = nlen - i;
for (i = 0; bar = index (foo, '.'); i++)
*bar = ' ';
nlen = nlen - i;
for (i = 0; bar = index (foo, '$'); i++)
*bar = ' ';
nlen = nlen - i;
/* Iteratively make blank the rightmost non-blank character on the
longest leftmost substring delmited by blanks, until it's short
enough. For example: "foobar foo bar" becomes, successively:
"fooba foo bar"
"foob foo bar"
"foo foo bar"
"fo foo bar"
"fo fo bar"
"fo fo ba "
"f fo ba "
"f f ba "
"f f b "
etc. */
while (nlen > max)
{
j = 0;
xlen = 0;
while (foo[j])
{
/* Find first non-blank */
if (foo[j])
for (i = j; foo[i]==' ' && foo[i]; i++)
;
/* Find the first blank */
j = i;
if (foo[j])
for (i = j + 1; foo[i] != ' ' && foo[i]; i++)
;
/* If this substring is the longest so far, remember the
position of the character to chop off. */
slen = i - j;
if (slen > xlen)
{
chopchar = i - 1;
xlen = slen;
}
j = i;
}
/* Try to avoid chopping uppercase suffix letters */
if (isupper (foo [chopchar]))
{
for (i = chopchar;
isupper (foo[i]) && foo[i] != ' ' && i >= 0;
i--)
;
if (islower (foo[i]))
chopchar = i;
}
foo [chopchar] = ' ';
nlen--;
}
/* Put the ..xx extension back */
if (len != tlen)
{
foo [len] = '.';
len = len + 4;
}
/* Collapse all the blanks */
j = 0;
for (i = 0; foo[i]; i++)
if (foo[i] != ' ')
foo[j++] = foo[i];
foo[j] = 0;
return foo;
}
/* Put back the ..xx extension */
if (len != tlen)
{
foo [len] = '.';
len = len + 4;
}
free (foo);
return name;
}
/* On vms we have two kinds of functions:
- stack frame (PROC_STACK)

View file

@ -141,20 +141,6 @@ Boston, MA 02111-1307, USA. */
+ ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \
? 6 - (CUM & 0xff) : 0)
extern char *vmskrunch ();
#undef ENCODE_SECTION_INFO
#define ENCODE_SECTION_INFO(DECL) \
do { \
if (TREE_CODE (DECL) == FUNCTION_DECL && ! TREE_PUBLIC (DECL)) \
SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \
\
if (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd' \
&& GET_CODE (DECL_RTL (DECL)) == MEM \
&& GET_CODE (XEXP (DECL_RTL (DECL), 0)) == SYMBOL_REF) \
XSTR (XEXP (DECL_RTL (DECL), 0), 0) \
= vmskrunch (XSTR (XEXP (DECL_RTL (DECL), 0), 0)); \
} while (0)
/* Perform any needed actions needed for a function that is receiving a
variable number of arguments.
@ -191,12 +177,6 @@ do { \
} \
}
#undef ASM_DECLARE_FUNCTION_NAME
#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
{ \
alpha_function_name = vmskrunch (NAME); \
}
#undef ASM_FILE_START
#define ASM_FILE_START(FILE) \
{ \

View file

@ -2,10 +2,13 @@ $! Set the def dir to proper place for use in batch. Works for interactive too.
$flnm = f$enviroment("PROCEDURE") ! get current procedure name
$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
$!
$ arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2
$ arch = f$element(arch_indx,"|","|vax|alpha|")
$!
$! Command file to build libgcc2.olb. You should only run this once you
$! have the current compiler installed, otherwise some of the builtins will
$! not be recognized. Once you have built libgcc2.olb, you can merge this
$! with gnu_cc:[000000]gcclib.olb
$! with gnu:[000000]gcclib.olb
$!
$! All of the source code is assumed to be in libgcc2.c, and a list of the
$! modules that we need from there is in libgcc2.list (which is generated
@ -13,38 +16,27 @@ $! when config-gcc.com is run).
$!
$if f$search("gcc-cc1.exe").eqs.""
$ then
$ gcc_cc1:=$gnu_cc:[000000]gcc-cc1
$ if f$extract(0,1,f$trnlnm("GNU_CC_VERSION")).eqs."1" then goto nocompile
$ gcc-cc1:=$gnu_cc_library:gcc-cc1
$ else
$ gcc_cc1:=$sys$disk:[]gcc-cc1
$ endif
$!
$if f$search("gcc-cpp.exe").eqs.""
$ then
$ gcc_cpp:=$gnu_cc:[000000]gcc-cpp
$ if f$extract(0,1,f$trnlnm("GNU_CC_VERSION")).eqs."1" then goto nocompile
$ Version:='f$trnlnm("GNU_CC_VERSION")'
$ gcc_cpp:=$gnu_cc_library:gcc-cpp
$ else
$ gcc_cpp:=$sys$disk:[]gcc-cpp
$ open ifile$ version.opt
$ read ifile$ line
$ close ifile$
$ Version=line-"ident="""-"""
$ endif
$!
$gcc_as:=$gnu_cc:[000000]gcc-as
$cpp_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.cpp
$s_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.s
$ gcc_as:=$gnu_root:[bin]as
$ cpp_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.cpp
$ s_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.s
$!
$set symbol/scope=(nolocal,noglobal)
$!
$goto compile
$!
$nocompile:
$write sys$error "You must have gcc version 2 in order to build libgcc2."
$exit 0
$!
$compile:
$lib/create libgcc2.olb
$on error then goto c_err
$on control_y then goto c_err
@ -68,17 +60,30 @@ $!
$! We do this by hand, since the VMS compiler driver does not have a way
$! of specifying an alternate location for the compiler executables.
$!
$ gcc_cpp "-I[]" "-I[.ginclude]" "-D''flnm'" libgcc2.c 'cpp_file'
$ gcc_cc1 'cpp_file' -dumpbase 'objname' -
$ if arch .eqs. "alpha"
$ then
$ gcc_cpp "-D__IEEE_FLOAT" "-I[]" "-I[.config]" "-I[.ginclude]" "-D''flnm'" libgcc2.c 'cpp_file'
$ gcc_cc1 'cpp_file' -dumpbase 'objname' -
-quiet -mgas "-O1" -mfloat-ieee -o 's_file'
$ else
$ gcc_cpp "-I[]" "-I[.config]" "-I[.ginclude]" "-D''flnm'" libgcc2.c 'cpp_file'
$ gcc_cc1 'cpp_file' -dumpbase 'objname' -
-quiet -mgnu -g "-O1" -mvaxc-alignment -o 's_file'
$ endif
$ delete/nolog 'cpp_file';
$ gcc_as "-vGNU CC V''Version'" 's_file' -o 'objname'.OBJ
$ gcc_as 's_file' -o 'objname'.OBJ
$ if arch .eqs. "vax"
$ then
$! Assemble again, preserving lowercase symbol names this time.
$ gcc_as "-vGNU CC V''Version'" -h3 's_file' -o 'objname'-c.OBJ
$ gcc_as -h3 's_file' -o 'objname'-c.OBJ
$ library libgcc2.olb 'objname'.obj,'objname'-c.obj
$ delete/nolog 'objname'.obj;,'objname'-c.obj;
$ else
$ library libgcc2.olb 'objname'.obj
$ delete/nolog 'objname'.obj;
$ endif
$ delete/nolog 's_file';
$!
$ library libgcc2.olb 'objname'.obj,'objname'-c.obj
$ delete/nolog 'objname'.obj;,'objname'-c.obj;
$!
$goto loop1
$!

View file

@ -1,7 +1,7 @@
$ !
$ ! Set up to compile GCC on VMS.
$ !
$! Set the def dir to proper place for use in batch. Works for interactive too.
$ ! Set the def dir to proper place for use in batch. Works for interactive too.
$flnm = f$enviroment("PROCEDURE") ! get current procedure name
$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
$ !
@ -14,8 +14,17 @@ $ arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2
$ arch = f$element(arch_indx,"|","|vax|alpha|")
$ !
$ if f$search("config.h") .nes. "" then delete config.h.*
$ copy [.config.'arch']xm-vms.h []config.h
$ echo "Linked `config.h' to `[.config.''arch']xm-vms.h'."
$ if arch .eqs. "vax"
$ then
$ copy [.config.'arch']xm-vms.h []config.h
$ echo "Linked `config.h' to `[.config.''arch']xm-vms.h'."
$else
$ open/write cfile []config.h
$ write cfile "#include "+"""config/"+arch+"/xm-"+arch+".h"+"""
$ write cfile "#include "+"""config/"+arch+"/xm-vms.h"+"""
$ close cfile
$ echo "Created `config.h'."
$ endif
$ !
$ if f$search("tconfig.h") .nes. "" then delete tconfig.h.*
$ create []tconfig.h
@ -34,7 +43,7 @@ $EOD
$ echo "Created `hconfig.h'.
$ !
$ if f$search("tm.h") .nes. "" then delete tm.h.*
$!! copy [.config.'arch']vms.h []tm.h
$ !
$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
[.config.'arch']vms.h /output=[]tm.h
$DECK
@ -60,7 +69,7 @@ $DECK
ENDLOOP;
WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
QUIT
$EOD
$ EOD
$ echo "Generated `tm.h' from `[.config.''arch']vms.h'."
$ !
$ !crude hack to allow compiling from [.cp] subdirectory
@ -72,18 +81,21 @@ $ call make_lang_incl "options.h"
$ !
$ call make_lang_incl "specs.h"
$ !
$ if f$search("''arch'.md") .nes. "" then delete 'arch'.md;*
$ copy [.config.'arch']'arch'.md []'arch'.md
$ echo "Copied `''arch'.md' from `[.config.''arch']''arch'.md'."
$ if arch .eqs. "vax"
$ then
$ if f$search("''arch'.md") .nes. "" then delete 'arch'.md;*
$ copy [.config.'arch']'arch'.md []'arch'.md
$ echo "Copied `''arch'.md' from `[.config.''arch']''arch'.md'."
$ endif
$ !
$ if f$search("aux-output.c") .nes. "" then delete aux-output.c.*
$ copy [.config.'arch']'arch'.c []aux-output.c
$ echo "Linked `aux-output.c' to `[.config.''arch']''arch'.c'.
$ !
$!
$!
$! Create the file version.opt, which helps identify the executable.
$!
$ !
$ !
$ ! Create the file version.opt, which helps identify the executable.
$ !
$search version.c version_string,"="/match=and/output=t.tmp
$open ifile$ t.tmp
$read ifile$ line
@ -95,19 +107,9 @@ $ijk=f$locate("""",line)
$line=f$extract(0,ijk,line)
$ijk=f$locate("\n",line)
$line=f$extract(0,ijk,line)
$!
$i=0
$loop:
$elm=f$element(i," ",line)
$if elm.eqs."" then goto no_ident
$if (elm.les."9").and.(elm.ges."0") then goto write_ident
$i=i+1
$goto loop
$!
$no_ident:
$elm="?.??"
$!
$!
$ !
$elm=f$element(1," ",line)
$ !
$write_ident:
$open/write ifile$ version.opt
$write ifile$ "ident="+""""+elm+""""
@ -175,6 +177,7 @@ PROCEDURE process_makefile( )
!
generate_option_file ("OBJS", "=", "independent.opt");
generate_option_file ("LIB2FUNCS", "=", "libgcc2.list");
generate_option_file ("CXX_LIB2FUNCS", "=", "libgcc2-cxx.list");
generate_option_file ("BC_ALL", "=", "bc_all.list");
generate_option_file ("BI_OBJ", "=", "bi_all.opt");
!
@ -239,6 +242,9 @@ PROCEDURE configure_makefile( )
COPY_TEXT ("out_object_file=aux-output.o"); SPLIT_LINE; ! aux-output.obj
COPY_TEXT ("md_file=" + arch + ".md"); SPLIT_LINE; ! 'arch'/'arch'.md
COPY_TEXT ("tm_file=tm.h"); SPLIT_LINE; ! 'arch'/tm-vms.h
pat_replace ("@" &
SPAN("abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ#~0123456789")
& "@", ); ! strip `configure' dummy values
ENDPROCEDURE; !configure_makefile
!!
@ -252,6 +258,8 @@ PROCEDURE identify_compilers( )
! Strip most comments from the makefile, to speed up subsequent processing.
POSITION (BEGINNING_OF (makefile_buf));
pat_replace (LINE_BEGIN & "#" & REMAIN & LINE_END, );
pat_replace ("$(exeext)", );
pat_replace ("@all_compilers@", );
!# ! Convert directory references to VMS syntax (actually, just strip it).
!# pat_replace (" $(srcdir)/", " ");
! Look up the ``COMPILERS=cc1 xyzzy'' Makefile macro and put