The attached patch gets objdump to report sensible things for the .pdata section. The new version outputs this :
The Function Table (interpreted .pdata section contents)
vma: Begin Prolog Function 32-bit Exception
Address Length Length Flag Flag
0001d000 00011008 00000002 000fffff 00000001 00000001
where the old version would say this :
Warning, .pdata section size (8) is not a multiple of 20
The Function Table (interpreted .pdata section contents)
vma: Begin End EH EH PrologEnd Exception
Address Address Handler Data Address Mask
I have a small problem in that I don't know how to identify SH4
processors in the code. I've now written
#if defined(ARM_WINCE) || defined(SH4)
but that may not actually work.
Comments & input welcomed.
Danny
--
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
Index: bfd/peXXigen.c
===================================================================
--- bfd/peXXigen.c (revision 1020)
+++ bfd/peXXigen.c (working copy)
@@ -1564,13 +1564,20 @@
/* This really is architecture dependent. On IA-64, a .pdata entry
consists of three dwords containing relative virtual addresses that
specify the start and end address of the code range the entry
- covers and the address of the corresponding unwind info data. */
+ covers and the address of the corresponding unwind info data.
+ On ARM and SH-4, a compressed PDATA structure is used :
+ _IMAGE_CE_RUNTIME_FUNCTION_ENTRY, whereas MIPS is documented to use
+ _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY.
+ See http://msdn2.microsoft.com/en-us/library/ms253988(VS.80).aspx .
+ */
static bfd_boolean
pe_print_pdata (bfd * abfd, void * vfile)
{
#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
# define PDATA_ROW_SIZE (3 * 8)
+#elif defined(ARM_WINCE) || defined(SH4)
+# define PDATA_ROW_SIZE (2 * 4)
#else
# define PDATA_ROW_SIZE (5 * 4)
#endif
@@ -1598,6 +1605,10 @@
#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
fprintf (file,
_(" vma:\t\t\tBegin Address End Address Unwind Info\n"));
+#elif defined(ARM_WINCE) || defined(SH4)
+ fprintf (file, _("\
+ vma:\t\tBegin Prolog Function 32-bit Exception\n\
+ \t\tAddress Length Length Flag Flag\n"));
#else
fprintf (file, _("\
vma:\t\tBegin End EH EH PrologEnd Exception\n\
@@ -1620,16 +1631,42 @@
for (i = start; i < stop; i += onaline)
{
bfd_vma begin_addr;
+#if defined(ARM_WINCE) || defined(SH4)
+ bfd_vma other_data;
+ bfd_vma prolog_length, function_length, flag32bit, exception_flag;
+#else
bfd_vma end_addr;
bfd_vma eh_handler;
bfd_vma eh_data;
bfd_vma prolog_end_addr;
int em_data;
+#endif
if (i + PDATA_ROW_SIZE > stop)
break;
+#if defined(ARM_WINCE) || defined(SH4)
begin_addr = GET_PDATA_ENTRY (abfd, data + i );
+ other_data = GET_PDATA_ENTRY (abfd, data + i + 4);
+
+ if (begin_addr == 0 && other_data == 0)
+ /* We are probably into the padding of the section now. */
+ break;
+
+ prolog_length = (other_data & 0x000000FF);
+ function_length = (other_data & 0x3FFFFF00) >> 8;
+ flag32bit = (other_data & 0x40000000) >> 30;
+ exception_flag = (other_data & 0x80000000) >> 31;
+
+ fputc (' ', file);
+ fprintf_vma (file, i + section->vma); fputc ('\t', file);
+ fprintf_vma (file, begin_addr); fputc (' ', file);
+ fprintf_vma (file, prolog_length); fputc (' ', file);
+ fprintf_vma (file, function_length); fputc (' ', file);
+ fprintf_vma (file, flag32bit); fputc (' ', file);
+ fprintf_vma (file, exception_flag);
+#else
+ begin_addr = GET_PDATA_ENTRY (abfd, data + i );
end_addr = GET_PDATA_ENTRY (abfd, data + i + 4);
eh_handler = GET_PDATA_ENTRY (abfd, data + i + 8);
eh_data = GET_PDATA_ENTRY (abfd, data + i + 12);
@@ -1655,6 +1692,7 @@
fprintf_vma (file, prolog_end_addr);
fprintf (file, " %x", em_data);
#endif
+#endif
#ifdef POWERPC_LE_PE
if (eh_handler == 0 && eh_data != 0)
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ Cegcc-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cegcc-devel
