mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-30 17:31:13 +08:00
PowerPC64 synthetic symbols
STT_FILE and a bunch of other symbol types aren't proper symbols to mark the start of a function's code. * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Trim uninteresting symbols. Use size_t counts. Delete redundant opd test.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2018-03-21 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Trim uninteresting
|
||||||
|
symbols. Use size_t counts. Delete redundant opd test.
|
||||||
|
|
||||||
2018-03-21 Alan Modra <amodra@gmail.com>
|
2018-03-21 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* elf32-ppc.c (ppc_elf_tls_optimize): Delete locsyms.
|
* elf32-ppc.c (ppc_elf_tls_optimize): Delete locsyms.
|
||||||
|
@ -3269,10 +3269,9 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
|
|||||||
asymbol **ret)
|
asymbol **ret)
|
||||||
{
|
{
|
||||||
asymbol *s;
|
asymbol *s;
|
||||||
long i;
|
size_t i, j, count;
|
||||||
long count;
|
|
||||||
char *names;
|
char *names;
|
||||||
long symcount, codesecsym, codesecsymend, secsymend, opdsymend;
|
size_t symcount, codesecsym, codesecsymend, secsymend, opdsymend;
|
||||||
asection *opd = NULL;
|
asection *opd = NULL;
|
||||||
bfd_boolean relocatable = (abfd->flags & (EXEC_P | DYNAMIC)) == 0;
|
bfd_boolean relocatable = (abfd->flags & (EXEC_P | DYNAMIC)) == 0;
|
||||||
asymbol **syms;
|
asymbol **syms;
|
||||||
@ -3317,13 +3316,20 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
|
|||||||
else
|
else
|
||||||
memcpy (syms, static_syms, (symcount + 1) * sizeof (*syms));
|
memcpy (syms, static_syms, (symcount + 1) * sizeof (*syms));
|
||||||
|
|
||||||
|
/* Trim uninteresting symbols. Interesting symbols are section,
|
||||||
|
function, and notype symbols. */
|
||||||
|
for (i = 0, j = 0; i < symcount; ++i)
|
||||||
|
if ((syms[i]->flags & (BSF_FILE | BSF_OBJECT | BSF_THREAD_LOCAL
|
||||||
|
| BSF_RELC | BSF_SRELC)) == 0)
|
||||||
|
syms[j++] = syms[i];
|
||||||
|
symcount = j;
|
||||||
|
|
||||||
synthetic_relocatable = relocatable;
|
synthetic_relocatable = relocatable;
|
||||||
synthetic_opd = opd;
|
synthetic_opd = opd;
|
||||||
qsort (syms, symcount, sizeof (*syms), compare_symbols);
|
qsort (syms, symcount, sizeof (*syms), compare_symbols);
|
||||||
|
|
||||||
if (!relocatable && symcount > 1)
|
if (!relocatable && symcount > 1)
|
||||||
{
|
{
|
||||||
long j;
|
|
||||||
/* Trim duplicate syms, since we may have merged the normal and
|
/* Trim duplicate syms, since we may have merged the normal and
|
||||||
dynamic symbols. Actually, we only care about syms that have
|
dynamic symbols. Actually, we only care about syms that have
|
||||||
different values, so trim any with the same value. */
|
different values, so trim any with the same value. */
|
||||||
@ -3339,7 +3345,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
|
|||||||
sym->section directly. With separate debug info files, the
|
sym->section directly. With separate debug info files, the
|
||||||
symbols will be extracted from the debug file while abfd passed
|
symbols will be extracted from the debug file while abfd passed
|
||||||
to this function is the real binary. */
|
to this function is the real binary. */
|
||||||
if (opd != NULL && strcmp (syms[i]->section->name, ".opd") == 0)
|
if (strcmp (syms[i]->section->name, ".opd") == 0)
|
||||||
++i;
|
++i;
|
||||||
codesecsym = i;
|
codesecsym = i;
|
||||||
|
|
||||||
@ -3374,7 +3380,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
|
|||||||
bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
|
bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
|
||||||
arelent *r;
|
arelent *r;
|
||||||
size_t size;
|
size_t size;
|
||||||
long relcount;
|
size_t relcount;
|
||||||
|
|
||||||
if (opdsymend == secsymend)
|
if (opdsymend == secsymend)
|
||||||
goto done;
|
goto done;
|
||||||
@ -3473,7 +3479,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
|
|||||||
bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
|
bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
|
||||||
bfd_byte *contents = NULL;
|
bfd_byte *contents = NULL;
|
||||||
size_t size;
|
size_t size;
|
||||||
long plt_count = 0;
|
size_t plt_count = 0;
|
||||||
bfd_vma glink_vma = 0, resolv_vma = 0;
|
bfd_vma glink_vma = 0, resolv_vma = 0;
|
||||||
asection *dynamic, *glink = NULL, *relplt = NULL;
|
asection *dynamic, *glink = NULL, *relplt = NULL;
|
||||||
arelent *p;
|
arelent *p;
|
||||||
@ -3610,7 +3616,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
|
|||||||
ent = bfd_get_64 (abfd, contents + syms[i]->value);
|
ent = bfd_get_64 (abfd, contents + syms[i]->value);
|
||||||
if (!sym_exists_at (syms, opdsymend, symcount, -1, ent))
|
if (!sym_exists_at (syms, opdsymend, symcount, -1, ent))
|
||||||
{
|
{
|
||||||
long lo, hi;
|
size_t lo, hi;
|
||||||
size_t len;
|
size_t len;
|
||||||
asection *sec = abfd->sections;
|
asection *sec = abfd->sections;
|
||||||
|
|
||||||
@ -3619,7 +3625,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
|
|||||||
hi = codesecsymend;
|
hi = codesecsymend;
|
||||||
while (lo < hi)
|
while (lo < hi)
|
||||||
{
|
{
|
||||||
long mid = (lo + hi) >> 1;
|
size_t mid = (lo + hi) >> 1;
|
||||||
if (syms[mid]->section->vma < ent)
|
if (syms[mid]->section->vma < ent)
|
||||||
lo = mid + 1;
|
lo = mid + 1;
|
||||||
else if (syms[mid]->section->vma > ent)
|
else if (syms[mid]->section->vma > ent)
|
||||||
|
Reference in New Issue
Block a user