Powerpc disassembly and gdb breakpoints

Ulrich Weigand uweigand@de.ibm.com
Wed May 14 16:03:00 GMT 2008


Alan Modra wrote:

> This patch from Ulrich Weigand implements synthetic symbols on plt
> call stubs for powerpc, and the same for powerpc64 except that the
> symbol is on the glink branch table instead.  See the fixme I added
> to explain why putting the synthetic symbol on the stub is difficult
> for ppc64.

Thanks for taking care of this!

Unfortunately, there were a couple of memset calls with swapped 
second and third parameters, which may cause parts of the symbol
data structure to remain uninitialized, leading to a crash in GDB.
(This bug was already in the original patch it sent to you, sorry!)

I've checked in the following obvious fix.

Bye,
Ulrich


ChangeLog:

	* elf32-ppc.c (ppc_elf_get_synthetic_symtab): Fix memset calls.
	* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Likewise.

Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.237
diff -c -p -r1.237 elf32-ppc.c
*** bfd/elf32-ppc.c	14 May 2008 02:21:19 -0000	1.237
--- bfd/elf32-ppc.c	14 May 2008 14:26:18 -0000
*************** ppc_elf_get_synthetic_symtab (bfd *abfd,
*** 2464,2470 ****
      }
  
    /* Add a symbol at the start of the glink branch table.  */
!   memset (s, sizeof *s, 0);
    s->the_bfd = abfd;
    s->flags = BSF_GLOBAL;
    s->section = glink;
--- 2464,2470 ----
      }
  
    /* Add a symbol at the start of the glink branch table.  */
!   memset (s, 0, sizeof *s);
    s->the_bfd = abfd;
    s->flags = BSF_GLOBAL;
    s->section = glink;
*************** ppc_elf_get_synthetic_symtab (bfd *abfd,
*** 2478,2484 ****
    if (resolv_vma)
      {
        /* Add a symbol for the glink PLT resolver.  */
!       memset (s, sizeof *s, 0);
        s->the_bfd = abfd;
        s->flags = BSF_GLOBAL;
        s->section = glink;
--- 2478,2484 ----
    if (resolv_vma)
      {
        /* Add a symbol for the glink PLT resolver.  */
!       memset (s, 0, sizeof *s);
        s->the_bfd = abfd;
        s->flags = BSF_GLOBAL;
        s->section = glink;
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.281
diff -c -p -r1.281 elf64-ppc.c
*** bfd/elf64-ppc.c	14 May 2008 02:21:19 -0000	1.281
--- bfd/elf64-ppc.c	14 May 2008 14:26:20 -0000
*************** ppc64_elf_get_synthetic_symtab (bfd *abf
*** 3143,3149 ****
  	  if (resolv_vma)
  	    {
  	      /* Add a symbol for the main glink trampoline.  */
! 	      memset (s, sizeof *s, 0);
  	      s->the_bfd = abfd;
  	      s->flags = BSF_GLOBAL;
  	      s->section = glink;
--- 3143,3149 ----
  	  if (resolv_vma)
  	    {
  	      /* Add a symbol for the main glink trampoline.  */
! 	      memset (s, 0, sizeof *s);
  	      s->the_bfd = abfd;
  	      s->flags = BSF_GLOBAL;
  	      s->section = glink;


-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com



More information about the Binutils mailing list