public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PowerPC64 synthetic syms
@ 2006-05-23  6:07 Alan Modra
  2006-05-23 15:48 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2006-05-23  6:07 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PowerPC64 synthetic syms
  2006-05-23  6:07 PowerPC64 synthetic syms Alan Modra
@ 2006-05-23 15:48 ` Andreas Schwab
  2006-05-24  8:13   ` Alan Modra
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2006-05-23 15:48 UTC (permalink / raw)
  To: binutils

Alan Modra <amodra@bigpond.net.au> writes:

> 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.

I think you want to apply that to the gdb-6.5 branch as well.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PowerPC64 synthetic syms
  2006-05-23 15:48 ` Andreas Schwab
@ 2006-05-24  8:13   ` Alan Modra
  2006-05-24  8:17     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2006-05-24  8:13 UTC (permalink / raw)
  To: Andreas Schwab, gdb-patches; +Cc: binutils

On Tue, May 23, 2006 at 02:09:42PM +0200, Andreas Schwab wrote:
> Alan Modra <amodra@bigpond.net.au> writes:
> 
> > 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.
> 
> I think you want to apply that to the gdb-6.5 branch as well.

Probably.  I'll need an OK from the relevant gdb authority.

http://sources.redhat.com/ml/binutils/2006-05/msg00389.html

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PowerPC64 synthetic syms
  2006-05-24  8:13   ` Alan Modra
@ 2006-05-24  8:17     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2006-05-24  8:17 UTC (permalink / raw)
  To: Andreas Schwab, gdb-patches, binutils

On Wed, May 24, 2006 at 09:06:57AM +0930, Alan Modra wrote:
> On Tue, May 23, 2006 at 02:09:42PM +0200, Andreas Schwab wrote:
> > Alan Modra <amodra@bigpond.net.au> writes:
> > 
> > > 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.
> > 
> > I think you want to apply that to the gdb-6.5 branch as well.
> 
> Probably.  I'll need an OK from the relevant gdb authority.
> 
> http://sources.redhat.com/ml/binutils/2006-05/msg00389.html

Yes Please.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-05-24  1:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-23  6:07 PowerPC64 synthetic syms Alan Modra
2006-05-23 15:48 ` Andreas Schwab
2006-05-24  8:13   ` Alan Modra
2006-05-24  8:17     ` Daniel Jacobowitz

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).