[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/1391] objcopy trashes PE executable when using "add-gnu-de

From: nickc at redhat dot com
Subject: [Bug binutils/1391] objcopy trashes PE executable when using "add-gnu-debuglink"
Date: 11 Oct 2005 16:05:32 -0000

------- Additional Comments From nickc at redhat dot com  2005-10-11 16:05 
Subject: Re:  objcopy trashes PE executable when using


> currently one can fix this manually by executing additional step:
> objcopy --change-section-vma .gnu_debuglink=+<addr> test_xxx.exe

> I did a grep on the sources but could not really find a location where the 
> wrong
> VMA might be produced..
> Could this be a bug in bfd library itself?

Yes, although I am not sure if an easy fix exists.  In the meantime 
please could you try the attached patch which might work.  The problem 
with it is that it has to guess as to the correct VMA value to use.  I 
am not sure if matters though.  It might be that any non-zero value will 
be valid, even if it overlaps with another section.


Index: binutils/objcopy.c
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.87
diff -c -3 -p -r1.87 objcopy.c
*** binutils/objcopy.c  3 Oct 2005 19:37:44 -0000       1.87
--- binutils/objcopy.c  11 Oct 2005 15:40:46 -0000
*************** copy_object (bfd *ibfd, bfd *obfd)
*** 1349,1354 ****
--- 1349,1361 ----
          bfd_nonfatal (gnu_debuglink_filename);
          return FALSE;
+       if (bfd_get_flavour (obfd) == bfd_target_coff_flavour)
+       /* Try to set the VMA of the section to some non-zero value so
+          that it will work for PE format files.  (We have no way to
+          distinguish between COFF and PE flavours).  If this does not
+          work, just ignore the failure.  */
+       bfd_set_section_vma (obfd, gnu_debuglink_section, 0xf0000000);
    if (bfd_count_sections (obfd) == 0)



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]