From: Alan Modra <amodra@bigpond.net.au>
To: binutils@sourceware.org
Subject: PowerPC64 synthetic syms
Date: Tue, 23 May 2006 06:07:00 -0000 [thread overview]
Message-ID: <20060523013214.GB12196@bubble.grove.modra.org> (raw)
PowerPC64 bfd_get_synthetic_symtab provides pseudo function entry
symbols (dot-symbols) for object files generated by newer toolchains.
This is useful for objdump disassembly of object files. gdb also has
at least one place where a dot-symbol is searched, solib-svr4.c
solib_break_names, so relies on bfd_get_synthetic_symtab. A recent
testcase shows this to be unreliable because the ppc64 back-end only
creates one synthetic sym for each function descriptor, and ld.so
happens to have *two* symbols pointing at the functions descriptor.
Which dot-symbol is created depends on symbol table hash order.
Really, gdb should be looking up the function descriptor syms itself
instead of relying on a crutch like the synthetic syms, but the
following patch happens to cure gdb and makes sense in isolation.
Applying mainline and 2.17.
* elf64-ppc.c (compare_symbols): Prefer strong dynamic global
function syms over other syms.
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.238
diff -u -p -r1.238 elf64-ppc.c
--- bfd/elf64-ppc.c 9 May 2006 03:38:30 -0000 1.238
+++ bfd/elf64-ppc.c 23 May 2006 01:29:40 -0000
@@ -2626,6 +2626,32 @@ compare_symbols (const void *ap, const v
if (a->value + a->section->vma > b->value + b->section->vma)
return 1;
+ /* For syms with the same value, prefer strong dynamic global function
+ syms over other syms. */
+ if ((a->flags & BSF_GLOBAL) != 0 && (b->flags & BSF_GLOBAL) == 0)
+ return -1;
+
+ if ((a->flags & BSF_GLOBAL) == 0 && (b->flags & BSF_GLOBAL) != 0)
+ return 1;
+
+ if ((a->flags & BSF_FUNCTION) != 0 && (b->flags & BSF_FUNCTION) == 0)
+ return -1;
+
+ if ((a->flags & BSF_FUNCTION) == 0 && (b->flags & BSF_FUNCTION) != 0)
+ return 1;
+
+ if ((a->flags & BSF_WEAK) == 0 && (b->flags & BSF_WEAK) != 0)
+ return -1;
+
+ if ((a->flags & BSF_WEAK) != 0 && (b->flags & BSF_WEAK) == 0)
+ return 1;
+
+ if ((a->flags & BSF_DYNAMIC) != 0 && (b->flags & BSF_DYNAMIC) == 0)
+ return -1;
+
+ if ((a->flags & BSF_DYNAMIC) == 0 && (b->flags & BSF_DYNAMIC) != 0)
+ return 1;
+
return 0;
}
--
Alan Modra
IBM OzLabs - Linux Technology Centre
next reply other threads:[~2006-05-23 1:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-23 6:07 Alan Modra [this message]
2006-05-23 15:48 ` Andreas Schwab
2006-05-24 8:13 ` Alan Modra
2006-05-24 8:17 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060523013214.GB12196@bubble.grove.modra.org \
--to=amodra@bigpond.net.au \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).