-/* 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
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
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;
-/* 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
#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 */
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);
}
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;
_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);
-/* 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
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
+#include <ctype.h>
#include "bfd.h"
#include "sysdep.h"
_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");
{
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;
-/* 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
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))
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))
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)
(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);
-/* 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
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;
-
- old_name = in;
-
- /* Do the case conversion. */
-
- 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;
+ in_len = strlen (in);
- if (in[i] == 0)
- truncate = 0;
+ result = (in_len > 64) ? hash_string (in) : 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 */
+ old_name = in;
- if (!PRIV(flag_hash_long_names))
- truncate = 0;
+ /* Do the length checking. */
- 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);
-/* 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.
#define ALPHA_R_OP_PRSHIFT 10
#define ALPHA_R_LINKAGE 11
#define ALPHA_R_REFLONG 12
+#define ALPHA_R_CODEADDR 13
/* Object language definitions. */
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
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 */