Thu Feb 13 20:53:22 1997 Klaus Kaempf (kkaempf@progis.de)

* reloc.c (BFD_RELOC_ALPHA_CODEADDR): New relocation for
	openVMS/Alpha.
	* evax.h (ALPHA_R_CODEADDR): New relocation.
	* evax-alpha.c (ALPHA_R_CODEADDR): 64 bit procedure relocation for
	openVMS/Alpha.
	* evax-etir.c (ALPHA_R_CODEADDR): Output object code for this
	relocation.
	* bfd-in2.h, libbfd.h: Rebuild.

	Restrict symbol length to 64 bytes, case preserving:
	* evax-emh.c (_bfd_evax_write_emh): Remove case hacking.
	* evax-misc.c (_bfd_evax_case_hack_symbol): Remove.
	(_bfd_evax_length_hash_symbol): Added.
	* evax-etir.c (_bfd_evax_write_etir): Call
	_bfd_evax_length_hash_symbol before output of symbol.
	* evax-egsd.c (_bfd_evax_write_egsd): Likewise.
	* evax.h (flag_hash_long_names, flag_show_after_trunc): Remove.

	* evax-emh.c: Output filename to object file without path.

	* evax-egsd.c: New sections for local and global commons.

	* evax-alpha.c, evax-emh.c, evax-egsd.c, evax-etir.c,
	evax-misc.c, evax.h: Remove 8 bit characters from copyright
	notices.  Replace AXP with Alpha.
This commit is contained in:
Ian Lance Taylor 1997-02-14 02:13:19 +00:00
parent 236969ac80
commit 8696b2db70
6 changed files with 137 additions and 190 deletions

View File

@ -1,6 +1,6 @@
/* evax-alpha.c -- BFD back-end for ALPHA EVAX (openVMS/AXP) files.
Copyright 1996 Free Software Foundation, Inc.
Written by Klaus Kämpf (kkaempf@progis.de)
/* evax-alpha.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files.
Copyright 1996, 1997 Free Software Foundation, Inc.
Written by Klaus K"ampf (kkaempf@progis.de)
of proGIS Softwareentwicklung, Aachen, Germany
This program is free software; you can redistribute it and/or modify
@ -1506,6 +1506,21 @@ static reloc_howto_type alpha_howto_table[] =
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* A 64 bit reference to a procedure, written as 32 bit value. */
HOWTO (ALPHA_R_CODEADDR, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
64, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed,/* complain_on_overflow */
reloc_nil, /* special_function */
"CODEADDR", /* name */
false, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
};
/* Return a pointer to a howto structure which, when invoked, will perform
@ -1534,13 +1549,7 @@ evax_bfd_reloc_type_lookup (abfd, code)
case BFD_RELOC_32_PCREL: alpha_type = ALPHA_R_SREL32; break;
case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break;
case BFD_RELOC_ALPHA_LINKAGE: alpha_type = ALPHA_R_LINKAGE; break;
#if 0
case ???: alpha_type = ALPHA_R_OP_PUSH; break;
case ???: alpha_type = ALPHA_R_OP_STORE; break;
case ???: alpha_type = ALPHA_R_OP_PSUB; break;
case ???: alpha_type = ALPHA_R_OP_PRSHIFT;break;
case ???: alpha_type = ALPHA_R_GPVALUE; break;
#endif
case BFD_RELOC_ALPHA_CODEADDR: alpha_type = ALPHA_R_CODEADDR; break;
default:
(*_bfd_error_handler) ("reloc (%d) is *UNKNOWN*", code);
return (const struct reloc_howto_struct *) NULL;

View File

@ -1,10 +1,10 @@
/* evax-egsd.c -- BFD back-end for ALPHA EVAX (openVMS/AXP) files.
Copyright 1996 Free Software Foundation Inc.
/* evax-egsd.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files.
Copyright 1996, 1997 Free Software Foundation Inc.
go and read the openVMS linker manual (esp. appendix B)
if you don't know what's going on here :-)
Written by Klaus Kämpf (kkaempf@progis.de)
Written by Klaus K"ampf (kkaempf@progis.de)
of proGIS Softwareentwicklung, Aachen, Germany
This program is free software; you can redistribute it and/or modify
@ -43,6 +43,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define EVAX_BSS_NAME "$BSS$"
#define EVAX_READONLY_NAME "$READONLY$"
#define EVAX_LITERAL_NAME "$LITERAL$"
#define EVAX_COMMON_NAME "$COMMON$"
#define EVAX_LOCAL_NAME "$LOCAL$"
struct sec_flags_struct {
char *name; /* name of section */
@ -463,6 +465,10 @@ _bfd_evax_write_egsd (abfd)
sname = EVAX_READONLY_NAME;
else if ((*sname == 'l') && (strcmp (sname, "literal") == 0))
sname = EVAX_LITERAL_NAME;
else if ((*sname == 'c') && (strcmp (sname, "comm") == 0))
sname = EVAX_COMMON_NAME;
else if ((*sname == 'l') && (strcmp (sname, "lcomm") == 0))
sname = EVAX_LOCAL_NAME;
}
_bfd_evax_output_begin (abfd, EGSD_S_C_PSC, -1);
@ -497,6 +503,11 @@ _bfd_evax_write_egsd (abfd)
}
old_flags = symbol->flags;
if ((*(symbol->section->name+1) == 'c')
&& (strcmp (symbol->section->name+1, "comm") == 0)
&& (strcmp (symbol->name, ".comm") != 0))
old_flags |= BSF_GLOBAL;
if (old_flags & BSF_FILE)
continue;
@ -555,7 +566,7 @@ _bfd_evax_write_egsd (abfd)
_bfd_evax_output_long (abfd, symbol->section->index);/* L_PSINDX, FIXME */
}
}
_bfd_evax_output_counted (abfd, _bfd_evax_case_hack_symbol (abfd, symbol->name));
_bfd_evax_output_counted (abfd, _bfd_evax_length_hash_symbol (abfd, symbol->name));
_bfd_evax_output_flush (abfd);

View File

@ -1,11 +1,11 @@
/* evax-emh.c -- BFD back-end for ALPHA EVAX (openVMS/AXP) files.
Copyright 1996 Free Software Foundation, Inc.
/* evax-emh.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files.
Copyright 1996, 1997 Free Software Foundation, Inc.
EMH record handling functions
and
EEOM record handling functions
Written by Klaus Kämpf (kkaempf@progis.de)
Written by Klaus K"ampf (kkaempf@progis.de)
of proGIS Softwareentwicklung, Aachen, Germany
This program is free software; you can redistribute it and/or modify
@ -23,6 +23,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <ctype.h>
#include "bfd.h"
#include "sysdep.h"
@ -196,7 +197,45 @@ _bfd_evax_write_emh (abfd)
_bfd_evax_output_long (abfd, MAX_OUTREC_SIZE);
if (bfd_get_filename (abfd) != 0)
_bfd_evax_output_counted (abfd, bfd_get_filename (abfd));
{
/* strip path and suffix information */
char *fname, *fout, *fptr;
fname = strdup (bfd_get_filename (abfd));
if (fname == 0)
{
bfd_set_error (bfd_error_no_memory);
return -1;
}
fout = strrchr (fname, ']');
if (fout == 0)
fout = strchr (fname, ':');
if (fout != 0)
fout++;
else
fout = fname;
/* strip .obj suffix */
fptr = strrchr (fname, '.');
if ((fptr != 0)
&& (strcasecmp (fptr, ".OBJ") == 0))
*fptr = 0;
fptr = fout;
while (*fptr != 0)
{
if (islower (*fptr))
*fptr = toupper (*fptr);
fptr++;
if ((*fptr == ';')
|| ((fptr - fout) > 31))
*fptr = 0;
}
_bfd_evax_output_counted (abfd, fout);
free (fname);
}
else
_bfd_evax_output_counted (abfd, "NONAME");
@ -227,8 +266,6 @@ _bfd_evax_write_emh (abfd)
{
PRIV(flag_hash_long_names) = symbol->name[6] - '0';
PRIV(flag_show_after_trunc) = symbol->name[7] - '0';
PRIV(flag_no_hash_mixed_case) = symbol->name[8] - '0';
PRIV(vms_name_mapping) = symbol->name[9] - '0';
if (had_file)
break;

View File

@ -1,11 +1,11 @@
/* evax-etir.c -- BFD back-end for ALPHA EVAX (openVMS/AXP) files.
Copyright 1996 Free Software Foundation, Inc.
/* evax-etir.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files.
Copyright 1996, 1997 Free Software Foundation, Inc.
ETIR record handling functions
go and read the openVMS linker manual (esp. appendix B)
if you don't know what's going on here :-)
Written by Klaus Kämpf (kkaempf@progis.de)
Written by Klaus K"ampf (kkaempf@progis.de)
of proGIS Softwareentwicklung, Aachen, Germany
This program is free software; you can redistribute it and/or modify
@ -1246,7 +1246,7 @@ _bfd_evax_write_etir (abfd)
ETIR_S_C_STO_GBL_LW,
-1);
_bfd_evax_output_counted (abfd,
_bfd_evax_case_hack_symbol (abfd, sym->name));
_bfd_evax_length_hash_symbol (abfd, sym->name));
_bfd_evax_output_flush (abfd);
}
else if (bfd_is_abs_section (sym->section))
@ -1312,7 +1312,7 @@ _bfd_evax_write_etir (abfd)
ETIR_S_C_STO_GBL,
-1);
_bfd_evax_output_counted (abfd,
_bfd_evax_case_hack_symbol (abfd, sym->name));
_bfd_evax_length_hash_symbol (abfd, sym->name));
_bfd_evax_output_flush (abfd);
}
else if (bfd_is_abs_section (sym->section))
@ -1374,29 +1374,11 @@ _bfd_evax_write_etir (abfd)
evax_output_long(abfd, (unsigned long)(sec->index));
evax_output_quad(abfd, (uquad)addr);
evax_output_counted(abfd, _bfd_evax_case_hack_symbol (abfd, sym->name));
evax_output_counted(abfd, _bfd_evax_length_hash_symbol (abfd, sym->name));
evax_output_flush(abfd);
#endif
}
break;
#if 0
case ALPHA_R_BRADDR:
break;
case ALPHA_R_SREL16:
break;
case ALPHA_R_SREL32:
break;
case ALPHA_R_SREL64:
break;
case ALPHA_R_OP_PUSH:
break;
case ALPHA_R_OP_STORE:
break;
case ALPHA_R_OP_PSUB:
break;
case ALPHA_R_OP_PRSHIFT:
break;
#endif
case ALPHA_R_LINKAGE:
{
if (_bfd_evax_output_check (abfd, 64) < 0)
@ -1412,12 +1394,32 @@ _bfd_evax_write_etir (abfd)
(unsigned long)PRIV(evax_linkage_index));
PRIV(evax_linkage_index) += 2;
_bfd_evax_output_counted (abfd,
_bfd_evax_case_hack_symbol (abfd, sym->name));
_bfd_evax_length_hash_symbol (abfd, sym->name));
_bfd_evax_output_byte (abfd, 0);
_bfd_evax_output_flush (abfd);
}
break;
case ALPHA_R_CODEADDR:
{
if (_bfd_evax_output_check (abfd,
strlen((char *)sym->name))
< 0)
{
end_etir_record (abfd);
start_etir_record (abfd,
section->index,
vaddr, false);
}
_bfd_evax_output_begin (abfd,
ETIR_S_C_STO_CA,
-1);
_bfd_evax_output_counted (abfd,
_bfd_evax_length_hash_symbol (abfd, sym->name));
_bfd_evax_output_flush (abfd);
}
break;
default:
(*_bfd_error_handler) ("Unhandled relocation %s",
(*rptr)->howto->name);

View File

@ -1,6 +1,7 @@
/* evax-misc.c -- Miscellaneous functions for ALPHA EVAX (openVMS/AXP) files.
Copyright 1996 Free Software Foundation, Inc.
Written by Klaus Kämpf (kkaempf@progis.de)
/* evax-misc.c -- Miscellaneous functions for ALPHA EVAX (openVMS/Alpha) files.
Copyright 1996, 1997 Free Software Foundation, Inc.
Written by Klaus K"ampf (kkaempf@progis.de)
of proGIS Softwareentwicklung, Aachen, Germany
This program is free software; you can redistribute it and/or modify
@ -971,172 +972,59 @@ hash_string (ptr)
return hash;
}
/* Generate a Case-Hacked VMS symbol name (limited to 64 chars). */
/* Generate a length-hashed VMS symbol name (limited to 64 chars). */
char *
_bfd_evax_case_hack_symbol (abfd, in)
_bfd_evax_length_hash_symbol (abfd, in)
bfd *abfd;
const char *in;
{
long int init;
long int result;
int in_len;
char *pnt = 0;
char *new_name;
const char *old_name;
int i;
int destructor = 0; /*hack to allow for case sens in a destructor*/
int truncate = 0;
int case_hack_bits = 0;
int saw_dollar = 0;
static char hex_table[16] =
{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
static char outbuf[65];
char *out = outbuf;
#if EVAX_DEBUG
evax_debug(4, "_bfd_evax_case_hack_symbol \"%s\"\n", in);
#endif
#if 0
/* Kill any leading "_". */ /* Why ? FIXME ! */
if ((in[0] == '_') && ((in[1] > '9') || (in[1] < '0')))
in++;
evax_debug(4, "_bfd_evax_length_hash_symbol \"%s\"\n", in);
#endif
new_name = out; /* save this for later. */
/* We may need to truncate the symbol, save the hash for later. */
result = (strlen (in) > 56) ? hash_string (in) : 0;
in_len = strlen (in);
result = (in_len > 64) ? hash_string (in) : 0;
old_name = in;
/* Do the case conversion. */
/* Do the length checking. */
i = 56; /* Maximum of 56 chars */
while (*in && (--i >= 0))
{
case_hack_bits <<= 1;
if (*in == '$')
saw_dollar = 1;
if ((destructor == 1) && (i == 54))
saw_dollar = 0;
switch (PRIV(vms_name_mapping))
{
case 0:
if (isupper (*in)) {
*out++ = *in++;
case_hack_bits |= 1;
} else {
*out++ = islower (*in) ? toupper (*in++) : *in++;
}
break;
case 3: *out++ = *in++;
break;
case 2:
if (islower (*in)) {
*out++ = *in++;
} else {
*out++ = isupper (*in) ? tolower (*in++) : *in++;
}
break;
}
}
/* if we saw a dollar sign, we don't do case hacking. */
if (PRIV(flag_no_hash_mixed_case) || saw_dollar)
case_hack_bits = 0;
/* if we have more than 56 characters and everything is lowercase
we can insert the full 64 characters. */
if (*in)
{
/* We have more than 56 characters
If we must add the case hack, then we have truncated the str. */
pnt = out;
truncate = 1;
if (case_hack_bits == 0)
{
/* And so far they are all lower case:
Check up to 8 more characters
and ensure that they are lowercase. */
for (i = 0; (in[i] != 0) && (i < 8); i++)
if (isupper (in[i]) && !saw_dollar && !PRIV(flag_no_hash_mixed_case))
break;
if (in[i] == 0)
truncate = 0;
if ((i == 8) || (in[i] == 0))
{
/* They are: Copy up to 64 characters
to the output string. */
i = 8;
while ((--i >= 0) && (*in))
{
switch (PRIV(vms_name_mapping))
{
case 0:
*out++ = islower (*in) ? toupper (*in++) : *in++;
break;
case 3:
*out++ = *in++;
break;
case 2:
*out++ = isupper (*in) ? tolower (*in++) : *in++;
break;
}
}
}
}
}
/* If there were any uppercase characters in the name we
take on the case hacking string. */
/* Old behavior for regular GNU-C compiler */
if (!PRIV(flag_hash_long_names))
truncate = 0;
if ((case_hack_bits != 0) || (truncate == 1))
{
if (truncate == 0)
{
*out++ = '_';
for (i = 0; i < 6; i++)
{
*out++ = hex_table[case_hack_bits & 0xf];
case_hack_bits >>= 4;
}
*out++ = 'X';
}
if (in_len <= 64)
i = in_len;
else
{
out = pnt; /* Cut back to 56 characters maximum */
*out++ = '_';
for (i = 0; i < 7; i++)
{
init = result & 0x01f;
*out++ = (init < 10) ? ('0' + init) : ('A' + init - 10);
result = result >> 5;
}
}
}
i = 55;
strncpy (out, in, i);
in += i;
out += i;
if ((in_len > 64)
&& PRIV(flag_hash_long_names))
sprintf (out, "_%08x", result);
else
*out = 0;
#if EVAX_DEBUG
evax_debug(4, "--> [%d]\"%s\"\n", strlen (outbuf), outbuf);
#endif
if (truncate == 1
if (in_len > 64
&& PRIV(flag_hash_long_names)
&& PRIV(flag_show_after_trunc))
printf ("Symbol %s replaced by %s\n", old_name, new_name);

View File

@ -1,6 +1,7 @@
/* evax.h -- Header file for ALPHA EVAX (openVMS/AXP) support.
Copyright 1996 Free Software Foundation, Inc.
Written by Klaus Kämpf (kkaempf@progis.de)
/* evax.h -- Header file for ALPHA EVAX (openVMS/Alpha) support.
Copyright 1996, 1997 Free Software Foundation, Inc.
Written by Klaus K"ampf (kkaempf@progis.de)
of proGIS Softwareentwicklung, Aachen, Germany
This file is part of BFD, the Binary File Descriptor library.
@ -179,6 +180,7 @@ extern int _bfd_evax_write_edbg PARAMS ((bfd *abfd));
#define ALPHA_R_OP_PRSHIFT 10
#define ALPHA_R_LINKAGE 11
#define ALPHA_R_REFLONG 12
#define ALPHA_R_CODEADDR 13
/* Object language definitions. */
@ -328,10 +330,8 @@ struct evax_private_data_struct {
int evax_linkage_index;
/* see tc-alpha.c of gas for a description. */
int flag_hash_long_names; /* -+ */
int flag_show_after_trunc; /* -H */
int flag_no_hash_mixed_case; /* -h NUM */
char vms_name_mapping;
int flag_hash_long_names; /* -+, hash instead of truncate */
int flag_show_after_trunc; /* -H, show hashing/truncation */
};
#define PRIV(name) ((struct evax_private_data_struct *)abfd->tdata.any)->name
@ -377,6 +377,6 @@ extern void _bfd_evax_output_counted PARAMS ((bfd *abfd, char *value));
extern void _bfd_evax_output_dump PARAMS ((bfd *abfd, unsigned char *data,
int length));
extern void _bfd_evax_output_fill PARAMS ((bfd *abfd, int value, int length));
extern char *_bfd_evax_case_hack_symbol PARAMS ((bfd *abfd, const char *in));
extern char *_bfd_evax_length_hash_symbol PARAMS ((bfd *abfd, const char *in));
#endif /* EVAX_H */