bfd/
2012-01-04 Tristan Gingold <gingold@adacore.com> * mach-o.c (bfd_mach_o_get_synthetic_symtab): Add comments.
This commit is contained in:
parent
fc55a90257
commit
aeefa1c9a5
|
@ -1,3 +1,7 @@
|
||||||
|
2012-01-04 Tristan Gingold <gingold@adacore.com>
|
||||||
|
|
||||||
|
* mach-o.c (bfd_mach_o_get_synthetic_symtab): Add comments.
|
||||||
|
|
||||||
2012-01-04 Tristan Gingold <gingold@adacore.com>
|
2012-01-04 Tristan Gingold <gingold@adacore.com>
|
||||||
|
|
||||||
* mach-o.h: Reindent header.
|
* mach-o.h: Reindent header.
|
||||||
|
|
|
@ -651,6 +651,8 @@ bfd_mach_o_canonicalize_symtab (bfd *abfd, asymbol **alocation)
|
||||||
return nsyms;
|
return nsyms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create synthetic symbols for indirect symbols. */
|
||||||
|
|
||||||
long
|
long
|
||||||
bfd_mach_o_get_synthetic_symtab (bfd *abfd,
|
bfd_mach_o_get_synthetic_symtab (bfd *abfd,
|
||||||
long symcount ATTRIBUTE_UNUSED,
|
long symcount ATTRIBUTE_UNUSED,
|
||||||
|
@ -670,19 +672,23 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd,
|
||||||
|
|
||||||
*ret = NULL;
|
*ret = NULL;
|
||||||
|
|
||||||
|
/* Stop now if no symbols or no indirect symbols. */
|
||||||
if (dysymtab == NULL || symtab == NULL || symtab->symbols == NULL)
|
if (dysymtab == NULL || symtab == NULL || symtab->symbols == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (dysymtab->nindirectsyms == 0)
|
if (dysymtab->nindirectsyms == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* We need to allocate a bfd symbol for every indirect symbol and to
|
||||||
|
allocate the memory for its name. */
|
||||||
count = dysymtab->nindirectsyms;
|
count = dysymtab->nindirectsyms;
|
||||||
size = count * sizeof (asymbol) + 1;
|
size = count * sizeof (asymbol) + 1;
|
||||||
|
|
||||||
for (j = 0; j < count; j++)
|
for (j = 0; j < count; j++)
|
||||||
{
|
{
|
||||||
unsigned int isym = dysymtab->indirect_syms[j];
|
unsigned int isym = dysymtab->indirect_syms[j];
|
||||||
|
|
||||||
|
/* Some indirect symbols are anonymous. */
|
||||||
if (isym < symtab->nsyms && symtab->symbols[isym].symbol.name)
|
if (isym < symtab->nsyms && symtab->symbols[isym].symbol.name)
|
||||||
size += strlen (symtab->symbols[isym].symbol.name) + sizeof ("$stub");
|
size += strlen (symtab->symbols[isym].symbol.name) + sizeof ("$stub");
|
||||||
}
|
}
|
||||||
|
@ -707,6 +713,7 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd,
|
||||||
case BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS:
|
case BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS:
|
||||||
case BFD_MACH_O_S_LAZY_SYMBOL_POINTERS:
|
case BFD_MACH_O_S_LAZY_SYMBOL_POINTERS:
|
||||||
case BFD_MACH_O_S_SYMBOL_STUBS:
|
case BFD_MACH_O_S_SYMBOL_STUBS:
|
||||||
|
/* Only these sections have indirect symbols. */
|
||||||
first = sec->reserved1;
|
first = sec->reserved1;
|
||||||
last = first + bfd_mach_o_section_get_nbr_indirect (abfd, sec);
|
last = first + bfd_mach_o_section_get_nbr_indirect (abfd, sec);
|
||||||
addr = sec->addr;
|
addr = sec->addr;
|
||||||
|
|
Loading…
Reference in New Issue