This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
E500 APUinfo fix
- From: Mark Mitchell <mark at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Cc: zack at codesourcery dot com
- Date: Mon, 23 Jun 2003 20:36:51 -0700
- Subject: E500 APUinfo fix
- Reply-to: mark at codesourcery dot com
Section 3.6 of the E500 ABI specifies the contents of the APU
Information Section, and requires that offset 4 contains the number of
bytes of APU information. However, GAS and binutils incorrectly use
the number of APU information slots -- rather than bytes.
Fixed with this patch.
OK to apply?
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2003-06-23 Mark Mitchell <mark@codesourcery.com>
* elf32-ppc.c (ppc_elf_begin_write_processing): Use bytes to count
APUinfo slots.
(ppc_elf_final_write_processing): Likewise.
2003-06-23 Mark Mitchell <mark@codesourcery.com>
* config/tc-ppc.c (ppc_cleanup): Use bytes to count APUinfo slots.
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.83
diff -c -5 -p -r1.83 elf32-ppc.c
*** bfd/elf32-ppc.c 31 May 2003 07:55:10 -0000 1.83
--- bfd/elf32-ppc.c 24 Jun 2003 03:30:02 -0000
*************** ppc_elf_begin_write_processing (abfd, li
*** 5719,5740 ****
goto fail;
if (strcmp (ptr + 12, APUINFO_LABEL) != 0)
goto fail;
! /* Get the number of apuinfo entries. */
datum = bfd_get_32 (ibfd, ptr + 4);
! if ((datum * 4 + 20) != length)
goto fail;
/* Make sure that we do not run off the end of the section. */
if (offset + length > output_section_size)
goto fail;
/* Scan the apuinfo section, building a list of apuinfo numbers. */
! for (i = 0; i < datum; i++)
! apuinfo_list_add (bfd_get_32 (ibfd, ptr + 20 + (i * 4)));
/* Update the offset. */
offset += length;
}
--- 5719,5740 ----
goto fail;
if (strcmp (ptr + 12, APUINFO_LABEL) != 0)
goto fail;
! /* Get the number of bytes used for apuinfo entries. */
datum = bfd_get_32 (ibfd, ptr + 4);
! if (datum + 20 != length)
goto fail;
/* Make sure that we do not run off the end of the section. */
if (offset + length > output_section_size)
goto fail;
/* Scan the apuinfo section, building a list of apuinfo numbers. */
! for (i = 0; i < datum; i += 4)
! apuinfo_list_add (bfd_get_32 (ibfd, ptr + 20 + i));
/* Update the offset. */
offset += length;
}
*************** ppc_elf_final_write_processing (abfd, li
*** 5806,5816 ****
}
/* Create the apuinfo header. */
num_entries = apuinfo_list_length ();
bfd_put_32 (abfd, sizeof APUINFO_LABEL, buffer);
! bfd_put_32 (abfd, num_entries, buffer + 4);
bfd_put_32 (abfd, 0x2, buffer + 8);
strcpy (buffer + 12, APUINFO_LABEL);
length = 20;
for (i = 0; i < num_entries; i++)
--- 5806,5816 ----
}
/* Create the apuinfo header. */
num_entries = apuinfo_list_length ();
bfd_put_32 (abfd, sizeof APUINFO_LABEL, buffer);
! bfd_put_32 (abfd, num_entries * 4, buffer + 4);
bfd_put_32 (abfd, 0x2, buffer + 8);
strcpy (buffer + 12, APUINFO_LABEL);
length = 20;
for (i = 0; i < num_entries; i++)
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.75
diff -c -5 -p -r1.75 tc-ppc.c
*** gas/config/tc-ppc.c 18 Jun 2003 23:05:44 -0000 1.75
--- gas/config/tc-ppc.c 24 Jun 2003 03:30:03 -0000
*************** ppc_cleanup ()
*** 1340,1350 ****
p = frag_more (4);
md_number_to_chars (p, (valueT) 8, 4);
p = frag_more (4);
! md_number_to_chars (p, (valueT) ppc_apuinfo_num, 4);
p = frag_more (4);
md_number_to_chars (p, (valueT) 2, 4);
p = frag_more (8);
--- 1340,1350 ----
p = frag_more (4);
md_number_to_chars (p, (valueT) 8, 4);
p = frag_more (4);
! md_number_to_chars (p, (valueT) ppc_apuinfo_num * 4, 4);
p = frag_more (4);
md_number_to_chars (p, (valueT) 2, 4);
p = frag_more (8);