* som.c (bfd_section_from_som_symbol): Renamed from
som_section_from_subspace_index. Pass in a native SOM symbol. For executables, iterate through the sections to find out which contains the symbol's address rather than using the symbol_info field. (symbol_info has a different meaning for dynamicly linked executables.)
This commit is contained in:
parent
d148e8c4fe
commit
c05d2d43a0
2 changed files with 41 additions and 13 deletions
|
@ -1,5 +1,12 @@
|
||||||
Sun Mar 20 09:24:36 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
|
Sun Mar 20 09:24:36 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
|
||||||
|
|
||||||
|
* som.c (bfd_section_from_som_symbol): Renamed from
|
||||||
|
som_section_from_subspace_index. Pass in a native SOM symbol.
|
||||||
|
For executables, iterate through the sections to find out
|
||||||
|
which contains the symbol's address rather than using the
|
||||||
|
symbol_info field. (symbol_info has a different meaning for
|
||||||
|
dynamicly linked executables.)
|
||||||
|
|
||||||
* trad-core.c (trad_unix_core_file_p): Don't pass abfd to
|
* trad-core.c (trad_unix_core_file_p): Don't pass abfd to
|
||||||
bfd_zmalloc.
|
bfd_zmalloc.
|
||||||
|
|
||||||
|
|
47
bfd/som.c
47
bfd/som.c
|
@ -166,8 +166,8 @@ static boolean som_find_nearest_line PARAMS ((bfd *, asection *,
|
||||||
CONST char **,
|
CONST char **,
|
||||||
unsigned int *));
|
unsigned int *));
|
||||||
static void som_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
|
static void som_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
|
||||||
static asection * som_section_from_subspace_index PARAMS ((bfd *,
|
static asection * bfd_section_from_som_symbol PARAMS ((bfd *,
|
||||||
unsigned int));
|
struct symbol_dictionary_record *));
|
||||||
static int log2 PARAMS ((unsigned int));
|
static int log2 PARAMS ((unsigned int));
|
||||||
static bfd_reloc_status_type hppa_som_reloc PARAMS ((bfd *, arelent *,
|
static bfd_reloc_status_type hppa_som_reloc PARAMS ((bfd *, arelent *,
|
||||||
asymbol *, PTR,
|
asymbol *, PTR,
|
||||||
|
@ -3616,18 +3616,41 @@ som_get_symtab_upper_bound (abfd)
|
||||||
/* Convert from a SOM subspace index to a BFD section. */
|
/* Convert from a SOM subspace index to a BFD section. */
|
||||||
|
|
||||||
static asection *
|
static asection *
|
||||||
som_section_from_subspace_index (abfd, index)
|
bfd_section_from_som_symbol (abfd, symbol)
|
||||||
bfd *abfd;
|
bfd *abfd;
|
||||||
unsigned int index;
|
struct symbol_dictionary_record *symbol;
|
||||||
{
|
{
|
||||||
asection *section;
|
asection *section;
|
||||||
|
|
||||||
for (section = abfd->sections; section != NULL; section = section->next)
|
/* The meaning of the symbol_info field changes for executables. So
|
||||||
if (section->target_index == index)
|
only use the quick symbol_info mapping for incomplete objects. */
|
||||||
return section;
|
if ((abfd->flags & EXEC_P) == 0)
|
||||||
|
{
|
||||||
|
unsigned int index = symbol->symbol_info;
|
||||||
|
for (section = abfd->sections; section != NULL; section = section->next)
|
||||||
|
if (section->target_index == index)
|
||||||
|
return section;
|
||||||
|
|
||||||
/* Should never happen. */
|
/* Should never happen. */
|
||||||
abort();
|
abort();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned int value = symbol->symbol_value;
|
||||||
|
unsigned int found = 0;
|
||||||
|
|
||||||
|
/* For executables we will have to use the symbol's address and
|
||||||
|
find out what section would contain that address. Yuk. */
|
||||||
|
for (section = abfd->sections; section; section = section->next)
|
||||||
|
{
|
||||||
|
if (value >= section->vma
|
||||||
|
&& value <= section->vma + section->_cooked_size)
|
||||||
|
return section;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Should never happen. */
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read and save the symbol table associated with the given BFD. */
|
/* Read and save the symbol table associated with the given BFD. */
|
||||||
|
@ -3762,8 +3785,7 @@ som_slurp_symbol_table (abfd)
|
||||||
|
|
||||||
case SS_UNIVERSAL:
|
case SS_UNIVERSAL:
|
||||||
sym->symbol.flags |= (BSF_EXPORT | BSF_GLOBAL);
|
sym->symbol.flags |= (BSF_EXPORT | BSF_GLOBAL);
|
||||||
sym->symbol.section
|
sym->symbol.section = bfd_section_from_som_symbol (abfd, bufp);
|
||||||
= som_section_from_subspace_index (abfd, bufp->symbol_info);
|
|
||||||
sym->symbol.value -= sym->symbol.section->vma;
|
sym->symbol.value -= sym->symbol.section->vma;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3774,8 +3796,7 @@ som_slurp_symbol_table (abfd)
|
||||||
#endif
|
#endif
|
||||||
case SS_LOCAL:
|
case SS_LOCAL:
|
||||||
sym->symbol.flags |= BSF_LOCAL;
|
sym->symbol.flags |= BSF_LOCAL;
|
||||||
sym->symbol.section
|
sym->symbol.section = bfd_section_from_som_symbol (abfd, bufp);
|
||||||
= som_section_from_subspace_index (abfd, bufp->symbol_info);
|
|
||||||
sym->symbol.value -= sym->symbol.section->vma;
|
sym->symbol.value -= sym->symbol.section->vma;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue