[vms/committed] use section pointer instead of section number in vms_symbol_entry
Tristan Gingold
gingold@adacore.com
Tue May 25 12:41:00 GMT 2010
Hi,
this patch is mostly an internal change to simplify a little bit the code. In the vms symbol structure,
we used to store the section number, but this it is more convenient to store the BFD section pointer.
I also removed the quirks used during BFD symbols creation, as it was only for gdb.
Tristan.
bfd/
2010-05-25 Tristan Gingold <gingold@adacore.com>
* vms-alpha.c (struct vms_symbol_entry): Field section is
now an asection pointer. Ditto for code_section.
(_bfd_vms_slurp_egsd): Adjust for above change.
(vms_get_symbol_info): Ditto.
(alpha_vms_convert_symbol): Ditto. Remove special dwarf2 case.
Remove commented out code.
(alpha_vms_get_synthetic_symtab): Simplify thanks to the above
change.
(alpha_vms_get_sym_value): Remove struct alpha_vms_link_hash_entry
parameter. Simplify the code.
(_bfd_vms_slurp_etir): Adjust for above change.
Index: bfd/vms-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-alpha.c,v
retrieving revision 1.16
diff -c -r1.16 vms-alpha.c
*** bfd/vms-alpha.c 25 May 2010 10:14:15 -0000 1.16
--- bfd/vms-alpha.c 25 May 2010 12:36:41 -0000
***************
*** 167,177 ****
unsigned short flags;
/* Section and offset/value of the symbol. */
- unsigned int section;
unsigned int value;
/* Section and offset/value for the entry point (only for subprg). */
! unsigned int code_section;
unsigned int code_value;
/* Symbol vector offset. */
--- 167,177 ----
unsigned short flags;
/* Section and offset/value of the symbol. */
unsigned int value;
+ asection *section;
/* Section and offset/value for the entry point (only for subprg). */
! asection *code_section;
unsigned int code_value;
/* Symbol vector offset. */
***************
*** 1217,1230 ****
struct vms_esdf *esdf = (struct vms_esdf *)vms_rec;
entry->value = bfd_getl64 (esdf->value);
! entry->section = bfd_getl32 (esdf->psindx);
if (old_flags & EGSY__V_NORM)
{
PRIV (norm_sym_count)++;
entry->code_value = bfd_getl64 (esdf->code_address);
! entry->code_section = bfd_getl32 (esdf->ca_psindx);
}
}
}
--- 1217,1231 ----
struct vms_esdf *esdf = (struct vms_esdf *)vms_rec;
entry->value = bfd_getl64 (esdf->value);
! entry->section = PRIV (sections)[bfd_getl32 (esdf->psindx)];
if (old_flags & EGSY__V_NORM)
{
PRIV (norm_sym_count)++;
entry->code_value = bfd_getl64 (esdf->code_address);
! entry->code_section =
! PRIV (sections)[bfd_getl32 (esdf->ca_psindx)];
}
}
}
***************
*** 1253,1259 ****
entry->symbol_vector = bfd_getl32 (egst->value);
! entry->section = bfd_getl32 (egst->psindx);
entry->value = bfd_getl64 (egst->lp_2);
if (old_flags & EGSY__V_NORM)
--- 1254,1264 ----
entry->symbol_vector = bfd_getl32 (egst->value);
! if (old_flags & EGSY__V_REL)
! entry->section = PRIV (sections)[bfd_getl32 (egst->psindx)];
! else
! entry->section = bfd_abs_section_ptr;
!
entry->value = bfd_getl64 (egst->lp_2);
if (old_flags & EGSY__V_NORM)
***************
*** 1261,1267 ****
PRIV (norm_sym_count)++;
entry->code_value = bfd_getl64 (egst->lp_1);
! entry->code_section = 0;
}
}
break;
--- 1266,1272 ----
PRIV (norm_sym_count)++;
entry->code_value = bfd_getl64 (egst->lp_1);
! entry->code_section = bfd_abs_section_ptr;
}
}
break;
***************
*** 1641,1656 ****
}
static bfd_vma
! alpha_vms_get_sym_value (unsigned int sect, bfd_vma addr,
! struct alpha_vms_link_hash_entry *h)
{
! asection *s;
!
! BFD_ASSERT (h && (h->root.type == bfd_link_hash_defined
! || h->root.type == bfd_link_hash_defweak));
!
! s = PRIV2 (h->root.u.def.section->owner, sections)[sect];
! return s->output_section->vma + s->output_offset + addr;
}
static bfd_vma
--- 1646,1654 ----
}
static bfd_vma
! alpha_vms_get_sym_value (asection *sect, bfd_vma addr)
{
! return sect->output_section->vma + sect->output_offset + addr;
}
static bfd_vma
***************
*** 1857,1863 ****
else
{
op1 = alpha_vms_get_sym_value (h->sym->section,
! h->sym->value, h);
alpha_vms_add_qw_reloc (info);
}
}
--- 1855,1861 ----
else
{
op1 = alpha_vms_get_sym_value (h->sym->section,
! h->sym->value);
alpha_vms_add_qw_reloc (info);
}
}
***************
*** 1881,1887 ****
else
{
op1 = alpha_vms_get_sym_value (h->sym->code_section,
! h->sym->code_value, h);
alpha_vms_add_qw_reloc (info);
}
}
--- 1879,1885 ----
else
{
op1 = alpha_vms_get_sym_value (h->sym->code_section,
! h->sym->code_value);
alpha_vms_add_qw_reloc (info);
}
}
***************
*** 1991,1999 ****
else
{
op1 = alpha_vms_get_sym_value (h->sym->code_section,
! h->sym->code_value, h);
op2 = alpha_vms_get_sym_value (h->sym->section,
! h->sym->value, h);
}
}
else
--- 1989,1997 ----
else
{
op1 = alpha_vms_get_sym_value (h->sym->code_section,
! h->sym->code_value);
op2 = alpha_vms_get_sym_value (h->sym->section,
! h->sym->value);
}
}
else
***************
*** 4644,4650 ****
if (e->flags & EGSY__V_NORM)
flags |= BSF_FUNCTION;
value = e->value;
! sec = PRIV (sections)[e->section];
}
else
{
--- 4642,4648 ----
if (e->flags & EGSY__V_NORM)
flags |= BSF_FUNCTION;
value = e->value;
! sec = e->section;
}
else
{
***************
*** 4670,4703 ****
if (e->flags & EGSY__V_NORM)
flags |= BSF_FUNCTION;
! value = e->symbol_vector;
!
! /* Adding this offset is necessary in order for GDB to
! read the DWARF-2 debug info from shared libraries. */
! if ((abfd->flags & DYNAMIC) && strstr (name, "$DWARF2.DEBUG") != 0)
! value += PRIV (symvva);
!
sec = bfd_abs_section_ptr;
- #if 0
- /* Find containing section. */
- {
- bfd_vma sbase = 0;
- asection *s;
-
- for (s = abfd->sections; s; s = s->next)
- {
- if (value >= s->vma
- && s->vma > sbase
- && !(s->flags & SEC_COFF_SHARED_LIBRARY)
- && (s->size > 0 || !(e->flags & EGSY__V_REL)))
- {
- sbase = s->vma;
- sec = s;
- }
- }
- value -= sbase;
- }
- #endif
break;
default:
--- 4668,4676 ----
if (e->flags & EGSY__V_NORM)
flags |= BSF_FUNCTION;
! value = e->value;
! /* sec = e->section; */
sec = bfd_abs_section_ptr;
break;
default:
***************
*** 5504,5546 ****
switch (e->typ)
{
case EGSD__C_SYM:
- if ((e->flags & EGSY__V_DEF) && (e->flags & EGSY__V_NORM))
- {
- value = e->code_value;
- sec = PRIV (sections)[e->code_section];
- }
- else
- continue;
- break;
-
case EGSD__C_SYMG:
if ((e->flags & EGSY__V_DEF) && (e->flags & EGSY__V_NORM))
{
- bfd_vma sbase = 0;
- asection *s;
-
value = e->code_value;
!
! /* Find containing section. */
! for (s = abfd->sections; s; s = s->next)
! {
! if (value >= s->vma
! && s->vma > sbase
! && !(s->flags & SEC_COFF_SHARED_LIBRARY)
! && (s->size > 0 || !(e->flags & EGSY__V_REL)))
! {
! sbase = s->vma;
! sec = s;
! }
! }
! value -= sbase;
}
else
continue;
break;
default:
! abort ();
}
l = strlen (name);
--- 5477,5494 ----
switch (e->typ)
{
case EGSD__C_SYM:
case EGSD__C_SYMG:
if ((e->flags & EGSY__V_DEF) && (e->flags & EGSY__V_NORM))
{
value = e->code_value;
! sec = e->code_section;
break;
default:
! continue;
}
l = strlen (name);
***************
*** 8941,8947 ****
if (ret == NULL)
return;
! if (sec == 0)
ret->type = 'U';
else if (bfd_is_com_section (sec))
ret->type = 'C';
--- 8889,8895 ----
if (ret == NULL)
return;
! if (sec == NULL)
ret->type = 'U';
else if (bfd_is_com_section (sec))
ret->type = 'C';
More information about the Binutils
mailing list