Wed Oct 2 15:46:45 1996 Klaus Kaempf <kkaempf@progis.de>
openVMS/Alpha: Provide filename and case_hack flags via symbol table from gas. Add case_hack code for symbol output from vax/vms. * evax-alpha.c (evax_initialize): Remove filename handling, filename is provided via symbol table. (evax_get_symtab): Use local symbol count when setting up table. * evax-egsd.c (_bfd_evax_slurp_egsd): Print correct name when debugging. (_bfd_evax_write_egsd): Skip file name symbol. * evax-emh.c (get_vms_time_string): Local function now. (_bfd_evax_write_emh): Extract source filename and case_hack flags from symbol table. * evax_write_etir (_bfd_evax_write_etir): Pass all symbol names through _bfd_evax_case_hack_symbol. * evax-misc.c (hash_string, _bfd_evax_case_hack_symbol): New functions. (_bfd_evax_basename): Removed. (_bfd_get_vms_time_string): Moved to evax-emh.c. * evax.h (evax_private_data_struct): Remove filename. (flag_hash_long_names, flag_show_after_trunc, flag_no_hash_mixed_case, vms_name_mapping): New flags for vms_case_hack.
This commit is contained in:
parent
1259da3e77
commit
bf53bd9faa
7 changed files with 306 additions and 173 deletions
|
@ -1,3 +1,28 @@
|
||||||
|
Wed Oct 2 15:46:45 1996 Klaus Kaempf <kkaempf@progis.de>
|
||||||
|
|
||||||
|
openVMS/Alpha: Provide filename and case_hack flags via
|
||||||
|
symbol table from gas.
|
||||||
|
Add case_hack code for symbol output from vax/vms.
|
||||||
|
* evax-alpha.c (evax_initialize): Remove filename handling,
|
||||||
|
filename is provided via symbol table.
|
||||||
|
(evax_get_symtab): Use local symbol count when setting up table.
|
||||||
|
* evax-egsd.c (_bfd_evax_slurp_egsd): Print correct name when
|
||||||
|
debugging.
|
||||||
|
(_bfd_evax_write_egsd): Skip file name symbol.
|
||||||
|
* evax-emh.c (get_vms_time_string): Local function now.
|
||||||
|
(_bfd_evax_write_emh): Extract source filename and case_hack flags
|
||||||
|
from symbol table.
|
||||||
|
* evax_write_etir (_bfd_evax_write_etir): Pass all symbol names
|
||||||
|
through _bfd_evax_case_hack_symbol.
|
||||||
|
* evax-misc.c (hash_string, _bfd_evax_case_hack_symbol): New
|
||||||
|
functions.
|
||||||
|
(_bfd_evax_basename): Removed.
|
||||||
|
(_bfd_get_vms_time_string): Moved to evax-emh.c.
|
||||||
|
* evax.h (evax_private_data_struct): Remove filename.
|
||||||
|
(flag_hash_long_names, flag_show_after_trunc,
|
||||||
|
flag_no_hash_mixed_case, vms_name_mapping): New flags for
|
||||||
|
vms_case_hack.
|
||||||
|
|
||||||
Wed Oct 2 12:02:02 1996 Ian Lance Taylor <ian@cygnus.com>
|
Wed Oct 2 12:02:02 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
* cofflink.c (_bfd_coff_link_input_bfd): Don't crash if there is
|
* cofflink.c (_bfd_coff_link_input_bfd): Don't crash if there is
|
||||||
|
|
|
@ -196,7 +196,6 @@ evax_initialize (abfd)
|
||||||
PRIV(buf_size) = 0;
|
PRIV(buf_size) = 0;
|
||||||
PRIV(rec_length) = 0;
|
PRIV(rec_length) = 0;
|
||||||
PRIV(file_format) = FF_UNKNOWN;
|
PRIV(file_format) = FF_UNKNOWN;
|
||||||
PRIV(filename) = NULL;
|
|
||||||
PRIV(fixup_done) = false;
|
PRIV(fixup_done) = false;
|
||||||
PRIV(sections) = NULL;
|
PRIV(sections) = NULL;
|
||||||
|
|
||||||
|
@ -530,12 +529,6 @@ evax_close_and_cleanup (abfd)
|
||||||
}
|
}
|
||||||
PRIV(buf_size) = 0;
|
PRIV(buf_size) = 0;
|
||||||
|
|
||||||
if (PRIV(filename) != NULL)
|
|
||||||
{
|
|
||||||
free (PRIV(filename));
|
|
||||||
PRIV(filename) = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PRIV(output_buf) != 0)
|
if (PRIV(output_buf) != 0)
|
||||||
{
|
{
|
||||||
free (PRIV(output_buf));
|
free (PRIV(output_buf));
|
||||||
|
@ -1010,9 +1003,9 @@ evax_get_symtab (abfd, symbols)
|
||||||
PRIV(symcache) = symbols;
|
PRIV(symcache) = symbols;
|
||||||
bfd_hash_traverse(PRIV(evax_symbol_table), copy_symbols, (PTR)abfd);
|
bfd_hash_traverse(PRIV(evax_symbol_table), copy_symbols, (PTR)abfd);
|
||||||
|
|
||||||
symbols[bfd_get_symcount(abfd)] = NULL;
|
symbols[PRIV(egsd_sym_count)] = NULL;
|
||||||
|
|
||||||
return bfd_get_symcount(abfd);
|
return PRIV(egsd_sym_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -318,11 +318,12 @@ _bfd_evax_slurp_egsd (abfd)
|
||||||
}
|
}
|
||||||
else /* symbol reference */
|
else /* symbol reference */
|
||||||
{
|
{
|
||||||
#if EVAX_DEBUG
|
|
||||||
evax_debug(3, "egsd sym ref #%d (%s, %04x=%s)\n", abfd->symcount, evax_rec+9, old_flags, flag2str(gsyflagdesc, old_flags));
|
|
||||||
#endif
|
|
||||||
symbol->name =
|
symbol->name =
|
||||||
_bfd_evax_save_counted_string ((char *)evax_rec+8);
|
_bfd_evax_save_counted_string ((char *)evax_rec+8);
|
||||||
|
#if EVAX_DEBUG
|
||||||
|
evax_debug(3, "egsd sym ref #%d (%s, %04x=%s)\n", abfd->symcount,
|
||||||
|
symbol->name, old_flags, flag2str(gsyflagdesc, old_flags));
|
||||||
|
#endif
|
||||||
symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME);
|
symbol->section = bfd_make_section (abfd, BFD_UND_SECTION_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,6 +497,9 @@ _bfd_evax_write_egsd (abfd)
|
||||||
}
|
}
|
||||||
old_flags = symbol->flags;
|
old_flags = symbol->flags;
|
||||||
|
|
||||||
|
if (old_flags & BSF_FILE)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (((old_flags & BSF_GLOBAL) == 0) /* not xdef */
|
if (((old_flags & BSF_GLOBAL) == 0) /* not xdef */
|
||||||
&& (!bfd_is_und_section (symbol->section))) /* and not xref */
|
&& (!bfd_is_und_section (symbol->section))) /* and not xref */
|
||||||
continue; /* dont output */
|
continue; /* dont output */
|
||||||
|
@ -551,24 +555,7 @@ _bfd_evax_write_egsd (abfd)
|
||||||
_bfd_evax_output_long (abfd, symbol->section->index);/* L_PSINDX, FIXME */
|
_bfd_evax_output_long (abfd, symbol->section->index);/* L_PSINDX, FIXME */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strlen ((char *)symbol->name) > 198)
|
_bfd_evax_output_counted (abfd, _bfd_evax_case_hack_symbol (abfd, symbol->name));
|
||||||
{
|
|
||||||
(*_bfd_error_handler) ("Name '%s' too long\n", symbol->name);
|
|
||||||
abort ();
|
|
||||||
}
|
|
||||||
nptr = (char *)symbol->name;
|
|
||||||
uptr = uname;
|
|
||||||
while (*nptr)
|
|
||||||
{
|
|
||||||
if (islower (*nptr))
|
|
||||||
*uptr = toupper (*nptr);
|
|
||||||
else
|
|
||||||
*uptr = *nptr;
|
|
||||||
uptr++;
|
|
||||||
nptr++;
|
|
||||||
}
|
|
||||||
*uptr = 0;
|
|
||||||
_bfd_evax_output_counted (abfd, uname);
|
|
||||||
|
|
||||||
_bfd_evax_output_flush (abfd);
|
_bfd_evax_output_flush (abfd);
|
||||||
|
|
||||||
|
|
|
@ -124,13 +124,62 @@ _bfd_evax_slurp_emh (abfd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Output routines. */
|
||||||
|
|
||||||
|
|
||||||
|
/* Manufacure a VMS like time on a unix based system.
|
||||||
|
stolen from obj-vms.c */
|
||||||
|
|
||||||
|
static unsigned char *
|
||||||
|
get_vms_time_string ()
|
||||||
|
{
|
||||||
|
static unsigned char tbuf[18];
|
||||||
|
#ifndef VMS
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
char *pnt;
|
||||||
|
time_t timeb;
|
||||||
|
time (&timeb);
|
||||||
|
pnt = ctime (&timeb);
|
||||||
|
pnt[3] = 0;
|
||||||
|
pnt[7] = 0;
|
||||||
|
pnt[10] = 0;
|
||||||
|
pnt[16] = 0;
|
||||||
|
pnt[24] = 0;
|
||||||
|
sprintf (tbuf, "%2s-%3s-%s %s", pnt + 8, pnt + 4, pnt + 20, pnt + 11);
|
||||||
|
#else
|
||||||
|
#include <starlet.h>
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int Size;
|
||||||
|
unsigned char *Ptr;
|
||||||
|
} Descriptor;
|
||||||
|
Descriptor.Size = 17;
|
||||||
|
Descriptor.Ptr = tbuf;
|
||||||
|
sys$asctim (0, &Descriptor, 0, 0);
|
||||||
|
#endif /* not VMS */
|
||||||
|
|
||||||
|
#if EVAX_DEBUG
|
||||||
|
evax_debug (6, "vmstimestring:'%s'\n", tbuf);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return tbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* write object header for bfd abfd */
|
/* write object header for bfd abfd */
|
||||||
|
|
||||||
int
|
int
|
||||||
_bfd_evax_write_emh (abfd)
|
_bfd_evax_write_emh (abfd)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
{
|
{
|
||||||
char *name;
|
asymbol *symbol;
|
||||||
|
int symnum;
|
||||||
|
int had_case = 0;
|
||||||
|
int had_file = 0;
|
||||||
|
|
||||||
|
|
||||||
#if EVAX_DEBUG
|
#if EVAX_DEBUG
|
||||||
evax_debug (2, "evax_write_emh(%p)\n", abfd);
|
evax_debug (2, "evax_write_emh(%p)\n", abfd);
|
||||||
|
@ -145,16 +194,14 @@ _bfd_evax_write_emh (abfd)
|
||||||
_bfd_evax_output_long (abfd, 0);
|
_bfd_evax_output_long (abfd, 0);
|
||||||
_bfd_evax_output_long (abfd, 0);
|
_bfd_evax_output_long (abfd, 0);
|
||||||
_bfd_evax_output_long (abfd, MAX_OUTREC_SIZE);
|
_bfd_evax_output_long (abfd, MAX_OUTREC_SIZE);
|
||||||
if (bfd_get_filename (abfd) != NULL)
|
|
||||||
{
|
if (bfd_get_filename (abfd) != 0)
|
||||||
name = strdup (bfd_get_filename (abfd));
|
_bfd_evax_output_counted (abfd, bfd_get_filename (abfd));
|
||||||
_bfd_evax_output_counted (abfd, _bfd_evax_basename (name));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
_bfd_evax_output_counted (abfd, "NONAME");
|
_bfd_evax_output_counted (abfd, "NONAME");
|
||||||
|
|
||||||
_bfd_evax_output_counted (abfd, BFD_VERSION);
|
_bfd_evax_output_counted (abfd, BFD_VERSION);
|
||||||
_bfd_evax_output_dump (abfd, (unsigned char *)_bfd_get_vms_time_string (),
|
_bfd_evax_output_dump (abfd, get_vms_time_string (), 17);
|
||||||
17);
|
|
||||||
_bfd_evax_output_fill (abfd, 0, 17);
|
_bfd_evax_output_fill (abfd, 0, 17);
|
||||||
_bfd_evax_output_flush (abfd);
|
_bfd_evax_output_flush (abfd);
|
||||||
|
|
||||||
|
@ -167,10 +214,38 @@ _bfd_evax_write_emh (abfd)
|
||||||
/* SRC */
|
/* SRC */
|
||||||
|
|
||||||
_bfd_evax_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_SRC);
|
_bfd_evax_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_SRC);
|
||||||
if (PRIV(filename) != 0)
|
|
||||||
_bfd_evax_output_dump (abfd, (unsigned char *)PRIV(filename), strlen (PRIV(filename)));
|
for (symnum = 0; symnum < abfd->symcount; symnum++)
|
||||||
else
|
{
|
||||||
_bfd_evax_output_dump (abfd, (unsigned char *)"noname", 6);
|
symbol = abfd->outsymbols[symnum];
|
||||||
|
|
||||||
|
if (symbol->flags & BSF_FILE)
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
|
||||||
|
if (strncmp ((char *)symbol->name, "<CASE:", 6) == 0)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
had_case = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
_bfd_evax_output_dump (abfd, (char *)symbol->name, strlen (symbol->name));
|
||||||
|
if (had_case)
|
||||||
|
break;
|
||||||
|
had_file = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (symnum == abfd->symcount)
|
||||||
|
_bfd_evax_output_dump (abfd, "noname", 6);
|
||||||
|
|
||||||
_bfd_evax_output_flush (abfd);
|
_bfd_evax_output_flush (abfd);
|
||||||
|
|
||||||
/* TTL */
|
/* TTL */
|
||||||
|
|
|
@ -1121,8 +1121,6 @@ _bfd_evax_write_etir (abfd)
|
||||||
asection *section;
|
asection *section;
|
||||||
evax_section *sptr;
|
evax_section *sptr;
|
||||||
int nextoffset;
|
int nextoffset;
|
||||||
char uname[200];
|
|
||||||
char *nptr, *uptr;
|
|
||||||
|
|
||||||
#if EVAX_DEBUG
|
#if EVAX_DEBUG
|
||||||
evax_debug (2, "evax_write_etir(%p)\n", abfd);
|
evax_debug (2, "evax_write_etir(%p)\n", abfd);
|
||||||
|
@ -1247,19 +1245,8 @@ _bfd_evax_write_etir (abfd)
|
||||||
_bfd_evax_output_begin (abfd,
|
_bfd_evax_output_begin (abfd,
|
||||||
ETIR_S_C_STO_GBL_LW,
|
ETIR_S_C_STO_GBL_LW,
|
||||||
-1);
|
-1);
|
||||||
uptr = uname;
|
_bfd_evax_output_counted (abfd,
|
||||||
nptr = (char *)sym->name;
|
_bfd_evax_case_hack_symbol (abfd, sym->name));
|
||||||
while (*nptr)
|
|
||||||
{
|
|
||||||
if (islower (*nptr))
|
|
||||||
*uptr = toupper (*nptr);
|
|
||||||
else
|
|
||||||
*uptr = *nptr;
|
|
||||||
nptr++;
|
|
||||||
uptr++;
|
|
||||||
}
|
|
||||||
*uptr = 0;
|
|
||||||
_bfd_evax_output_counted (abfd, uname);
|
|
||||||
_bfd_evax_output_flush (abfd);
|
_bfd_evax_output_flush (abfd);
|
||||||
}
|
}
|
||||||
else if (bfd_is_abs_section (sym->section))
|
else if (bfd_is_abs_section (sym->section))
|
||||||
|
@ -1324,19 +1311,8 @@ _bfd_evax_write_etir (abfd)
|
||||||
_bfd_evax_output_begin (abfd,
|
_bfd_evax_output_begin (abfd,
|
||||||
ETIR_S_C_STO_GBL,
|
ETIR_S_C_STO_GBL,
|
||||||
-1);
|
-1);
|
||||||
uptr = uname;
|
_bfd_evax_output_counted (abfd,
|
||||||
nptr = (char *)sym->name;
|
_bfd_evax_case_hack_symbol (abfd, sym->name));
|
||||||
while (*nptr)
|
|
||||||
{
|
|
||||||
if (islower (*nptr))
|
|
||||||
*uptr = toupper (*nptr);
|
|
||||||
else
|
|
||||||
*uptr = *nptr;
|
|
||||||
nptr++;
|
|
||||||
uptr++;
|
|
||||||
}
|
|
||||||
*uptr = 0;
|
|
||||||
_bfd_evax_output_counted (abfd, uname);
|
|
||||||
_bfd_evax_output_flush (abfd);
|
_bfd_evax_output_flush (abfd);
|
||||||
}
|
}
|
||||||
else if (bfd_is_abs_section (sym->section))
|
else if (bfd_is_abs_section (sym->section))
|
||||||
|
@ -1397,20 +1373,8 @@ _bfd_evax_write_etir (abfd)
|
||||||
evax_output_begin(abfd, ETIR_S_C_STO_HINT_GBL, -1);
|
evax_output_begin(abfd, ETIR_S_C_STO_HINT_GBL, -1);
|
||||||
evax_output_long(abfd, (unsigned long)(sec->index));
|
evax_output_long(abfd, (unsigned long)(sec->index));
|
||||||
evax_output_quad(abfd, (uquad)addr);
|
evax_output_quad(abfd, (uquad)addr);
|
||||||
uptr = uname;
|
|
||||||
nptr = (char *)(*(*rptr)->sym_ptr_ptr)->name;
|
|
||||||
while (*nptr)
|
|
||||||
{
|
|
||||||
if (islower (*nptr))
|
|
||||||
*uptr = toupper (*nptr);
|
|
||||||
else
|
|
||||||
*uptr = *nptr;
|
|
||||||
nptr++;
|
|
||||||
uptr++;
|
|
||||||
}
|
|
||||||
*uptr = 0;
|
|
||||||
|
|
||||||
evax_output_counted(abfd, uname);
|
evax_output_counted(abfd, _bfd_evax_case_hack_symbol (abfd, sym->name));
|
||||||
evax_output_flush(abfd);
|
evax_output_flush(abfd);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1447,19 +1411,8 @@ _bfd_evax_write_etir (abfd)
|
||||||
_bfd_evax_output_long (abfd,
|
_bfd_evax_output_long (abfd,
|
||||||
(unsigned long)PRIV(evax_linkage_index));
|
(unsigned long)PRIV(evax_linkage_index));
|
||||||
PRIV(evax_linkage_index) += 2;
|
PRIV(evax_linkage_index) += 2;
|
||||||
uptr = uname;
|
_bfd_evax_output_counted (abfd,
|
||||||
nptr = (char *)(*(*rptr)->sym_ptr_ptr)->name;
|
_bfd_evax_case_hack_symbol (abfd, sym->name));
|
||||||
while (*nptr)
|
|
||||||
{
|
|
||||||
if (islower (*nptr))
|
|
||||||
*uptr = toupper (*nptr);
|
|
||||||
else
|
|
||||||
*uptr = *nptr;
|
|
||||||
nptr++;
|
|
||||||
uptr++;
|
|
||||||
}
|
|
||||||
*uptr = 0;
|
|
||||||
_bfd_evax_output_counted (abfd, uname);
|
|
||||||
_bfd_evax_output_byte (abfd, 0);
|
_bfd_evax_output_byte (abfd, 0);
|
||||||
_bfd_evax_output_flush (abfd);
|
_bfd_evax_output_flush (abfd);
|
||||||
}
|
}
|
||||||
|
|
245
bfd/evax-misc.c
245
bfd/evax-misc.c
|
@ -565,7 +565,7 @@ add_new_contents (abfd, section)
|
||||||
newptr = (evax_section *) bfd_malloc (sizeof (evax_section));
|
newptr = (evax_section *) bfd_malloc (sizeof (evax_section));
|
||||||
if (newptr == (evax_section *) NULL)
|
if (newptr == (evax_section *) NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
newptr->contents = (unsigned char *) bfd_alloc (abfd, section->_raw_size);
|
newptr->contents = (unsigned char *) bfd_alloc (abfd, (int)section->_raw_size);
|
||||||
if (newptr->contents == (unsigned char *)NULL)
|
if (newptr->contents == (unsigned char *)NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
newptr->offset = 0;
|
newptr->offset = 0;
|
||||||
|
@ -952,98 +952,195 @@ _bfd_evax_output_fill (abfd, value, count)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/* this hash routine borrowed from GNU-EMACS, and strengthened slightly ERY*/
|
||||||
|
|
||||||
/* Return basename (stripped of directory information) of filename */
|
static int
|
||||||
|
hash_string (ptr)
|
||||||
char *
|
const char *ptr;
|
||||||
_bfd_evax_basename (name)
|
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
char *ptr;
|
register const unsigned char *p = (unsigned char *) ptr;
|
||||||
|
register const unsigned char *end = p + strlen (ptr);
|
||||||
|
register unsigned char c;
|
||||||
|
register int hash = 0;
|
||||||
|
|
||||||
|
while (p != end)
|
||||||
|
{
|
||||||
|
c = *p++;
|
||||||
|
hash = ((hash << 3) + (hash << 15) + (hash >> 28) + c);
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Generate a Case-Hacked VMS symbol name (limited to 64 chars). */
|
||||||
|
char *
|
||||||
|
_bfd_evax_case_hack_symbol (abfd, in)
|
||||||
|
bfd *abfd;
|
||||||
|
const char *in;
|
||||||
|
{
|
||||||
|
long int init;
|
||||||
|
long int result;
|
||||||
|
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
|
#if EVAX_DEBUG
|
||||||
evax_debug (6, "_bfd_evax_basename %s -> ", name);
|
evax_debug(4, "_bfd_evax_case_hack_symbol \"%s\"\n", in);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef VMS
|
#if 0
|
||||||
/* assume unix host */
|
/* Kill any leading "_". */ /* Why ? FIXME ! */
|
||||||
ptr = strrchr (name, '.');
|
|
||||||
if (ptr)
|
if ((in[0] == '_') && ((in[1] > '9') || (in[1] < '0')))
|
||||||
*ptr = 0;
|
in++;
|
||||||
ptr = strrchr (name, '/');
|
#endif
|
||||||
if (ptr)
|
|
||||||
*ptr++ = 0;
|
new_name = out; /* save this for later. */
|
||||||
else
|
|
||||||
ptr = name;
|
/* We may need to truncate the symbol, save the hash for later. */
|
||||||
#else
|
|
||||||
/* assume vms host */
|
result = (strlen (in) > 56) ? hash_string (in) : 0;
|
||||||
ptr = strrchr (name, '.');
|
|
||||||
if (ptr)
|
old_name = in;
|
||||||
|
|
||||||
|
/* Do the case conversion. */
|
||||||
|
|
||||||
|
i = 56; /* Maximum of 56 chars */
|
||||||
|
|
||||||
|
while (*in && (--i >= 0))
|
||||||
{
|
{
|
||||||
*ptr = 0;
|
case_hack_bits <<= 1;
|
||||||
ptr = name;
|
if (*in == '$')
|
||||||
}
|
saw_dollar = 1;
|
||||||
else
|
if ((destructor == 1) && (i == 54))
|
||||||
{
|
saw_dollar = 0;
|
||||||
ptr = strrchr (name, ']');
|
switch (PRIV(vms_name_mapping))
|
||||||
if (ptr)
|
|
||||||
*ptr++ = 0;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
ptr = strrchr (name, ':');
|
case 0:
|
||||||
if (ptr)
|
if (isupper (*in)) {
|
||||||
*ptr++ = 0;
|
*out++ = *in++;
|
||||||
else
|
case_hack_bits |= 1;
|
||||||
ptr = name;
|
} 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if EVAX_DEBUG
|
/* if we saw a dollar sign, we don't do case hacking. */
|
||||||
evax_debug (6, "%s\n", ptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ptr;
|
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. */
|
||||||
|
|
||||||
/* Manufacure a VMS like time on a unix based system.
|
/* Old behavior for regular GNU-C compiler */
|
||||||
stolen from obj-vms.c */
|
|
||||||
|
|
||||||
char *
|
if (!PRIV(flag_hash_long_names))
|
||||||
_bfd_get_vms_time_string ()
|
truncate = 0;
|
||||||
{
|
|
||||||
static char tbuf[18];
|
|
||||||
#ifndef VMS
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
char *pnt;
|
if ((case_hack_bits != 0) || (truncate == 1))
|
||||||
time_t timeb;
|
{
|
||||||
time (&timeb);
|
if (truncate == 0)
|
||||||
pnt = ctime (&timeb);
|
{
|
||||||
pnt[3] = 0;
|
*out++ = '_';
|
||||||
pnt[7] = 0;
|
for (i = 0; i < 6; i++)
|
||||||
pnt[10] = 0;
|
{
|
||||||
pnt[16] = 0;
|
*out++ = hex_table[case_hack_bits & 0xf];
|
||||||
pnt[24] = 0;
|
case_hack_bits >>= 4;
|
||||||
sprintf (tbuf, "%2s-%3s-%s %s", pnt + 8, pnt + 4, pnt + 20, pnt + 11);
|
}
|
||||||
#else
|
*out++ = 'X';
|
||||||
#include <starlet.h>
|
}
|
||||||
struct
|
else
|
||||||
{
|
{
|
||||||
int Size;
|
out = pnt; /* Cut back to 56 characters maximum */
|
||||||
char *Ptr;
|
*out++ = '_';
|
||||||
} Descriptor;
|
for (i = 0; i < 7; i++)
|
||||||
Descriptor.Size = 17;
|
{
|
||||||
Descriptor.Ptr = tbuf;
|
init = result & 0x01f;
|
||||||
sys$asctim (0, &Descriptor, 0, 0);
|
*out++ = (init < 10) ? ('0' + init) : ('A' + init - 10);
|
||||||
#endif /* not VMS */
|
result = result >> 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*out = 0;
|
||||||
|
|
||||||
#if EVAX_DEBUG
|
#if EVAX_DEBUG
|
||||||
evax_debug (6, "vmstimestring:'%s'\n", tbuf);
|
evax_debug(4, "--> [%d]\"%s\"\n", strlen (outbuf), outbuf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return tbuf;
|
if (truncate == 1
|
||||||
|
&& PRIV(flag_hash_long_names)
|
||||||
|
&& PRIV(flag_show_after_trunc))
|
||||||
|
printf ("Symbol %s replaced by %s\n", old_name, new_name);
|
||||||
|
|
||||||
|
return outbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,6 @@ struct location_struct {
|
||||||
#define EVAX_SECTION_COUNT 32
|
#define EVAX_SECTION_COUNT 32
|
||||||
|
|
||||||
struct evax_private_data_struct {
|
struct evax_private_data_struct {
|
||||||
char *filename; /* Filename of object file */
|
|
||||||
boolean fixup_done; /* Flag to indicate if all
|
boolean fixup_done; /* Flag to indicate if all
|
||||||
section pointers and PRIV(sections)
|
section pointers and PRIV(sections)
|
||||||
are set up correctly */
|
are set up correctly */
|
||||||
|
@ -328,6 +327,11 @@ struct evax_private_data_struct {
|
||||||
|
|
||||||
int evax_linkage_index;
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PRIV(name) ((struct evax_private_data_struct *)abfd->tdata.any)->name
|
#define PRIV(name) ((struct evax_private_data_struct *)abfd->tdata.any)->name
|
||||||
|
@ -373,7 +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,
|
extern void _bfd_evax_output_dump PARAMS ((bfd *abfd, unsigned char *data,
|
||||||
int length));
|
int length));
|
||||||
extern void _bfd_evax_output_fill PARAMS ((bfd *abfd, int value, int length));
|
extern void _bfd_evax_output_fill PARAMS ((bfd *abfd, int value, int length));
|
||||||
extern char *_bfd_get_vms_time_string PARAMS ((void));
|
extern char *_bfd_evax_case_hack_symbol PARAMS ((bfd *abfd, const char *in));
|
||||||
extern char *_bfd_evax_basename PARAMS ((char *name));
|
|
||||||
|
|
||||||
#endif /* EVAX_H */
|
#endif /* EVAX_H */
|
||||||
|
|
Loading…
Reference in a new issue