Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Unified Diff: bfd/vms-alpha.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bfd/version.h ('k') | bfd/vms-lib.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bfd/vms-alpha.c
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 8b98560743731a3d8983e9800cd8c4407c589a38..09438aebf1d203c882ac305c87e5eddded83a2b1 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -1,6 +1,5 @@
/* vms.c -- BFD back-end for EVAX (openVMS/Alpha) files.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright 1996-2013 Free Software Foundation, Inc.
Initial version written by Klaus Kaempf (kkaempf@rmi.de)
Major rewrite by Adacore.
@@ -331,10 +330,6 @@ struct vms_private_data_struct
/* linkage index counter used by conditional store commands */
unsigned int vms_linkage_index;
-
- /* see tc-alpha.c of gas for a description. */
- int flag_hash_long_names; /* -+, hash instead of truncate */
- int flag_show_after_trunc; /* -H, show hashing/truncation */
};
#define PRIV2(abfd, name) \
@@ -2686,88 +2681,6 @@ _bfd_vms_write_eeom (bfd *abfd)
return TRUE;
}
-/* This hash routine borrowed from GNU-EMACS, and strengthened
- slightly. ERY. */
-
-static int
-hash_string (const char *ptr)
-{
- const unsigned char *p = (unsigned char *) ptr;
- const unsigned char *end = p + strlen (ptr);
- unsigned char c;
- int hash = 0;
-
- while (p != end)
- {
- c = *p++;
- hash = ((hash << 3) + (hash << 15) + (hash >> 28) + c);
- }
- return hash;
-}
-
-/* Generate a length-hashed VMS symbol name (limited to maxlen chars). */
-
-static char *
-_bfd_vms_length_hash_symbol (bfd *abfd, const char *in, int maxlen)
-{
- unsigned long result;
- int in_len;
- char *new_name;
- const char *old_name;
- int i;
- static char outbuf[EOBJ__C_SYMSIZ + 1];
- char *out = outbuf;
-
-#if VMS_DEBUG
- vms_debug (4, "_bfd_vms_length_hash_symbol \"%s\"\n", in);
-#endif
-
- if (maxlen > EOBJ__C_SYMSIZ)
- maxlen = EOBJ__C_SYMSIZ;
-
- /* Save this for later. */
- new_name = out;
-
- /* We may need to truncate the symbol, save the hash for later. */
- in_len = strlen (in);
-
- result = (in_len > maxlen) ? hash_string (in) : 0;
-
- old_name = in;
-
- /* Do the length checking. */
- if (in_len <= maxlen)
- i = in_len;
- else
- {
- if (PRIV (flag_hash_long_names))
- i = maxlen - 9;
- else
- i = maxlen;
- }
-
- strncpy (out, in, (size_t) i);
- in += i;
- out += i;
-
- if ((in_len > maxlen)
- && PRIV (flag_hash_long_names))
- sprintf (out, "_%08lx", result);
- else
- *out = 0;
-
-#if VMS_DEBUG
- vms_debug (4, "--> [%d]\"%s\"\n", (int)strlen (outbuf), outbuf);
-#endif
-
- if (in_len > maxlen
- && PRIV (flag_hash_long_names)
- && PRIV (flag_show_after_trunc))
- printf (_("Symbol %s replaced by %s\n"), old_name, new_name);
-
- return outbuf;
-}
-
static void
vector_grow1 (struct vector_type *vec, size_t elsz)
{
@@ -3241,7 +3154,6 @@ alpha_vms_write_exec (bfd *abfd)
for (i = 0; i < PRIV (gsd_sym_count); i++)
{
struct vms_symbol_entry *sym = PRIV (syms)[i];
- char *hash;
bfd_vma val;
bfd_vma ep;
@@ -3268,8 +3180,7 @@ alpha_vms_write_exec (bfd *abfd)
_bfd_vms_output_quad (recwr, ep);
_bfd_vms_output_quad (recwr, val);
_bfd_vms_output_long (recwr, 0);
- hash = _bfd_vms_length_hash_symbol (abfd, sym->name, EOBJ__C_SYMSIZ);
- _bfd_vms_output_counted (recwr, hash);
+ _bfd_vms_output_counted (recwr, sym->name);
_bfd_vms_output_end_subrec (recwr);
if ((i % 5) == 4)
_bfd_vms_output_end (abfd, recwr);
@@ -3364,8 +3275,6 @@ _bfd_vms_write_egsd (bfd *abfd)
else if ((*sname == 'l') && (strcmp (sname, "lcomm") == 0))
sname = EVAX_LOCAL_NAME;
}
- else
- sname = _bfd_vms_length_hash_symbol (abfd, sname, EOBJ__C_SECSIZ);
if (bfd_is_com_section (section))
new_flags = (EGPS__V_OVR | EGPS__V_REL | EGPS__V_GBL | EGPS__V_RD
@@ -3405,18 +3314,13 @@ _bfd_vms_write_egsd (bfd *abfd)
for (symnum = 0; symnum < abfd->symcount; symnum++)
{
- char *hash;
-
symbol = abfd->outsymbols[symnum];
old_flags = symbol->flags;
/* Work-around a missing feature: consider __main as the main entry
point. */
- if (*(symbol->name) == '_')
- {
- if (strcmp (symbol->name, "__main") == 0)
- bfd_set_start_address (abfd, (bfd_vma)symbol->value);
- }
+ if (symbol->name[0] == '_' && strcmp (symbol->name, "__main") == 0)
+ bfd_set_start_address (abfd, (bfd_vma)symbol->value);
/* Only put in the GSD the global and the undefined symbols. */
if (old_flags & BSF_FILE)
@@ -3509,8 +3413,7 @@ _bfd_vms_write_egsd (bfd *abfd)
_bfd_vms_output_long (recwr, ca_psindx);
_bfd_vms_output_long (recwr, psindx);
}
- hash = _bfd_vms_length_hash_symbol (abfd, symbol->name, EOBJ__C_SYMSIZ);
- _bfd_vms_output_counted (recwr, hash);
+ _bfd_vms_output_counted (recwr, symbol->name);
_bfd_vms_output_end_subrec (recwr);
}
@@ -3528,8 +3431,6 @@ _bfd_vms_write_ehdr (bfd *abfd)
{
asymbol *symbol;
unsigned int symnum;
- int had_case = 0;
- int had_file = 0;
struct vms_rec_wr *recwr = &PRIV (recwr);
vms_debug2 ((2, "vms_write_ehdr (%p)\n", abfd));
@@ -3549,22 +3450,9 @@ _bfd_vms_write_ehdr (bfd *abfd)
if (symbol->flags & BSF_FILE)
{
- if (CONST_STRNEQ ((char *)symbol->name, "<CASE:"))
- {
- PRIV (flag_hash_long_names) = symbol->name[6] - '0';
- PRIV (flag_show_after_trunc) = symbol->name[7] - '0';
-
- if (had_file)
- break;
- had_case = 1;
- continue;
- }
-
_bfd_vms_output_dump (recwr, (unsigned char *) symbol->name,
(int) strlen (symbol->name));
- if (had_case)
- break;
- had_file = 1;
+ break;
}
}
@@ -3800,7 +3688,6 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
asection *sec = sym->section;
bfd_boolean defer = defer_reloc_p (rptr);
unsigned int slen;
- char *hash;
if (pass2_in_progress)
{
@@ -3839,13 +3726,11 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
{
bfd_vma addend = rptr->addend;
slen = strlen ((char *) sym->name);
- hash = _bfd_vms_length_hash_symbol
- (abfd, sym->name, EOBJ__C_SYMSIZ);
etir_output_check (abfd, section, curr_addr, slen);
if (addend)
{
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_GBL);
- _bfd_vms_output_counted (recwr, hash);
+ _bfd_vms_output_counted (recwr, sym->name);
_bfd_vms_output_end_subrec (recwr);
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_LW);
_bfd_vms_output_long (recwr, (unsigned long) addend);
@@ -3859,7 +3744,7 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
{
_bfd_vms_output_begin_subrec
(recwr, ETIR__C_STO_GBL_LW);
- _bfd_vms_output_counted (recwr, hash);
+ _bfd_vms_output_counted (recwr, sym->name);
_bfd_vms_output_end_subrec (recwr);
}
}
@@ -3894,13 +3779,11 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
{
bfd_vma addend = rptr->addend;
slen = strlen ((char *) sym->name);
- hash = _bfd_vms_length_hash_symbol
- (abfd, sym->name, EOBJ__C_SYMSIZ);
etir_output_check (abfd, section, curr_addr, slen);
if (addend)
{
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_GBL);
- _bfd_vms_output_counted (recwr, hash);
+ _bfd_vms_output_counted (recwr, sym->name);
_bfd_vms_output_end_subrec (recwr);
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_QW);
_bfd_vms_output_quad (recwr, addend);
@@ -3913,7 +3796,7 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
else
{
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STO_GBL);
- _bfd_vms_output_counted (recwr, hash);
+ _bfd_vms_output_counted (recwr, sym->name);
_bfd_vms_output_end_subrec (recwr);
}
}
@@ -3950,20 +3833,16 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
(recwr, (unsigned long) rptr->addend);
if (rptr->addend > PRIV (vms_linkage_index))
PRIV (vms_linkage_index) = rptr->addend;
- hash = _bfd_vms_length_hash_symbol
- (abfd, sym->name, EOBJ__C_SYMSIZ);
- _bfd_vms_output_counted (recwr, hash);
+ _bfd_vms_output_counted (recwr, sym->name);
_bfd_vms_output_byte (recwr, 0);
_bfd_vms_output_end_subrec (recwr);
break;
case ALPHA_R_CODEADDR:
slen = strlen ((char *) sym->name);
- hash = _bfd_vms_length_hash_symbol
- (abfd, sym->name, EOBJ__C_SYMSIZ);
etir_output_check (abfd, section, curr_addr, slen);
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STO_CA);
- _bfd_vms_output_counted (recwr, hash);
+ _bfd_vms_output_counted (recwr, sym->name);
_bfd_vms_output_end_subrec (recwr);
break;
@@ -3981,9 +3860,7 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
_bfd_vms_output_long
(recwr, (unsigned long) section->target_index);
_bfd_vms_output_quad (recwr, rptr->addend);
- _bfd_vms_output_counted
- (recwr, _bfd_vms_length_hash_symbol
- (abfd, udata->origname, EOBJ__C_SYMSIZ));
+ _bfd_vms_output_counted (recwr, udata->origname);
_bfd_vms_output_end_subrec (recwr);
break;
@@ -4006,9 +3883,7 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
_bfd_vms_output_long
(recwr, (unsigned long) udata->bsym->section->target_index);
_bfd_vms_output_quad (recwr, rptr->addend);
- _bfd_vms_output_counted
- (recwr, _bfd_vms_length_hash_symbol
- (abfd, udata->origname, EOBJ__C_SYMSIZ));
+ _bfd_vms_output_counted (recwr, udata->origname);
_bfd_vms_output_end_subrec (recwr);
break;
@@ -4026,9 +3901,7 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
_bfd_vms_output_long
(recwr, (unsigned long) section->target_index);
_bfd_vms_output_quad (recwr, rptr->addend);
- _bfd_vms_output_counted
- (recwr, _bfd_vms_length_hash_symbol
- (abfd, udata->origname, EOBJ__C_SYMSIZ));
+ _bfd_vms_output_counted (recwr, udata->origname);
_bfd_vms_output_end_subrec (recwr);
break;
@@ -4741,6 +4614,26 @@ _bfd_vms_find_nearest_dst_line (bfd *abfd, asection *section,
return FALSE;
}
+
+/* Likewise but with a discriminator. */
+
+static bfd_boolean
+_bfd_vms_find_nearest_line_discriminator (bfd *abfd,
+ asection *section,
+ asymbol **symbols,
+ bfd_vma offset,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *line_ptr,
+ unsigned int *discriminator)
+{
+ *discriminator = 0;
+
+ return _bfd_vms_find_nearest_dst_line (abfd, section, symbols, offset,
+ filename_ptr, functionname_ptr,
+ line_ptr);
+}
+
/* Canonicalizations. */
/* Set name, value, section and flags of SYM from E. */
@@ -6044,7 +5937,7 @@ evax_bfd_print_etir (FILE *file, const char *name,
unsigned char *rec, unsigned int rec_len)
{
unsigned int off = sizeof (struct vms_egsd);
- unsigned int sec_len;
+ unsigned int sec_len = 0;
fprintf (file, _(" %s (len=%u+%u):\n"), name,
(unsigned)(rec_len - sizeof (struct vms_eobjrec)),
@@ -7849,7 +7742,7 @@ evax_bfd_print_image (bfd *abfd, FILE *file)
}
if (lpfixoff != 0)
{
- fprintf (file, _(" Linkage Pairs Referece Fixups:\n"));
+ fprintf (file, _(" Linkage Pairs Reference Fixups:\n"));
evax_bfd_print_reference_fixups (file, buf + lpfixoff);
}
if (chgprtoff)
@@ -9118,7 +9011,8 @@ vms_new_section_hook (bfd * abfd, asection *section)
vms_debug2 ((1, "vms_new_section_hook (%p, [%d]%s)\n",
abfd, section->index, section->name));
- bfd_set_section_alignment (abfd, section, 0);
+ if (! bfd_set_section_alignment (abfd, section, 0))
+ return FALSE;
vms_debug2 ((7, "%d: %s\n", section->index, section->name));
@@ -9228,7 +9122,6 @@ static bfd_boolean
vms_bfd_is_local_label_name (bfd * abfd ATTRIBUTE_UNUSED,
const char *name)
{
- vms_debug2 ((1, "vms_bfd_is_local_label_name (%p, %s)\n", abfd, name));
return name[0] == '$';
}
@@ -9322,6 +9215,8 @@ bfd_vms_get_data (bfd *abfd)
#define alpha_vms_find_inliner_info _bfd_nosymbols_find_inliner_info
#define alpha_vms_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
#define alpha_vms_find_nearest_line _bfd_vms_find_nearest_dst_line
+#define _bfd_generic_find_nearest_line_discriminator \
+ _bfd_vms_find_nearest_line_discriminator
#define alpha_vms_bfd_is_local_label_name vms_bfd_is_local_label_name
/* Generic table. */
« no previous file with comments | « bfd/version.h ('k') | bfd/vms-lib.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698