[patch]: dump of PE+ x64 pdata section

H.J. Lu hjl.tools@gmail.com
Mon Apr 6 16:47:00 GMT 2009


On Mon, Apr 6, 2009 at 9:31 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Apr 6, 2009 at 12:23 AM, Kai Tietz <ktietz70@googlemail.com> wrote:
>> 2009/4/6 Dave Korn <dave.korn.cygwin@googlemail.com>:
>>> Jan Kratochvil wrote:
>>>> Hi Kai,
>>>>
>>>> getting now on Fedora 10 x86_64:
>>>>
>>>> $ ./configure; make
>>>
>>>  You didn't use --enable-targets=all, but you're still getting a PE backend
>>> in your BFD?  That's odd.
>>>
>>>> ../bfd/.libs/libbfd.a(pex64igen.o): In function `_bfd_pep_print_x64_pdata':
>>>> .../binutils-cvs/bfd/pex64igen.c:1901: multiple definition of `_bfd_pep_print_x64_pdata'
>>>> ../bfd/.libs/libbfd.a(peigen.o):.../binutils-cvs/bfd/peigen.c:1901: first defined here
>>>
>>>  Argh.  Try changing the definition in peXXigen.c from
>>>
>>> _bfd_pep_print_x64_pdata
>>>
>>> to
>>>
>>> _bfd_XX_print_x64_pdata.
>>>
>>>  It might also need wrapping in a #ifdef so that it only gets compiled for
>>> x64 targets.
>>>
>>>  Sorry, can't help more right away; I just broke my world after a bad system
>>> update and am still scrambling to be able to build anything right now :-(
>>>
>>>    cheers,
>>>      DaveK
>>>
>>>
>>
>> Sorry, for this breakage. I want to use the 'ifdef COFF_WITH_pex64'
>> guard for this. So we prevent to generate useless functions for other
>> targets (as sadly the arm variant does).
>>
>> I tested the patch with all and it fixes my breakage.
>>
>
> Binutils won't build with --enable-targets=all on Linux/x86-64:
>
> libtool: compile:  gcc -DHAVE_CONFIG_H -I.
> -I/export/gnu/import/svn/binutils/src/bfd -I. -I.
> -I/export/gnu/import/svn/binutils/src/bfd
> -I/export/gnu/import/svn/binutils/src/bfd/../include -W -Wall
> -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c
> /export/gnu/import/svn/binutils/src/bfd/pei-x86_64.c -o pei-x86_64.o
> In file included from
> /export/gnu/import/svn/binutils/src/bfd/coff-x86_64.c:718:/export/gnu/import/svn/binutils/src/bfd/coffcode.h:5414:
> error: ‘_bfd_pep_print_x64_pdata’ undeclared here (not in a function)
> cc1: warnings being treated as errors
> /export/gnu/import/svn/binutils/src/bfd/coffcode.h:5415: error:
> missing initializer
> /export/gnu/import/svn/binutils/src/bfd/coffcode.h:5415: error: (near
> initialization for ‘bfd_coff_std_swap_table._bfd_coff_print_pdata’)
> make[6]: *** [coff-x86_64.lo] Error 1
>
>


I am checking in this patch to fix binutils build.


-- 
H.J.
---
2009-04-05  H.J. Lu  <hongjiu.lu@intel.com>

	* coff-x86_64.c (bfd_pe_print_pdata): Defined to
	_bfd_pex64_print_pdata only if PE is defined.

	* libpei.h (_bfd_pep_print_x64_pdata): Renamed to ...
	(_bfd_pex64_print_pdata): This.

	* peXXigen.c (_bfd_pep_print_x64_pdata): Renamed to ...
	(_bfd_pex64_print_pdata): This.  Defined only if COFF_WITH_pex64
	is defined.
-------------- next part --------------
Index: bfd/ChangeLog
===================================================================
--- bfd/ChangeLog	(revision 5639)
+++ bfd/ChangeLog	(working copy)
@@ -1,3 +1,15 @@
+2009-04-05  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* coff-x86_64.c (bfd_pe_print_pdata): Defined to
+	_bfd_pex64_print_pdata only if PE is defined.
+
+	* libpei.h (_bfd_pep_print_x64_pdata): Renamed to ...
+	(_bfd_pex64_print_pdata): This.
+
+	* peXXigen.c (_bfd_pep_print_x64_pdata): Renamed to ...
+	(_bfd_pex64_print_pdata): This.  Defined only if COFF_WITH_pex64
+	is defined.
+
 2009-04-05  Kai Tietz  <kai.tietz@onevision.com>
 
 	* coff-x86_64.c (bfd_pe_print_pdata): Define as
Index: bfd/libpei.h
===================================================================
--- bfd/libpei.h	(revision 5639)
+++ bfd/libpei.h	(working copy)
@@ -393,5 +393,5 @@ bfd_boolean _bfd_pe_print_ce_compressed_
 bfd_boolean _bfd_pe64_print_ce_compressed_pdata (bfd *, void *);
 bfd_boolean _bfd_pex64_print_ce_compressed_pdata (bfd *, void *);
 bfd_boolean _bfd_pep_print_ce_compressed_pdata (bfd *, void *);
-bfd_boolean _bfd_pep_print_x64_pdata (bfd *, void *);
 
+bfd_boolean _bfd_pex64_print_pdata (bfd *, void *);
Index: bfd/coff-x86_64.c
===================================================================
--- bfd/coff-x86_64.c	(revision 5639)
+++ bfd/coff-x86_64.c	(working copy)
@@ -711,8 +711,14 @@ coff_amd64_is_local_label_name (bfd *abf
 
 #endif /* TARGET_UNDERSCORE */
 
+#ifdef PE
 #undef  bfd_pe_print_pdata
-#define bfd_pe_print_pdata   _bfd_pep_print_x64_pdata
+#define bfd_pe_print_pdata   _bfd_pex64_print_pdata
+#else  /* PE */
+#ifndef bfd_pe_print_pdata
+#define bfd_pe_print_pdata   NULL
+#endif
+#endif /* PE */
 
 #include "coffcode.h"
 
Index: bfd/peXXigen.c
===================================================================
--- bfd/peXXigen.c	(revision 5639)
+++ bfd/peXXigen.c	(working copy)
@@ -1895,9 +1895,10 @@ _bfd_XX_print_ce_compressed_pdata (bfd *
 #undef PDATA_ROW_SIZE
 }
 
+#ifdef COFF_WITH_pex64
 /* The PE+ x64 variant.  */
 bfd_boolean
-_bfd_pep_print_x64_pdata (bfd *abfd, void *vfile)
+_bfd_pex64_print_pdata (bfd *abfd, void *vfile)
 {
 # define PDATA_ROW_SIZE	(3 * 4)
   FILE *file = (FILE *) vfile;
@@ -1974,6 +1975,7 @@ _bfd_pep_print_x64_pdata (bfd *abfd, voi
   return TRUE;
 #undef PDATA_ROW_SIZE
 }
+#endif
 

 #define IMAGE_REL_BASED_HIGHADJ 4
 static const char * const tbl[] =


More information about the Binutils mailing list