[Bug binutils/1391] objcopy trashes PE executable when using add-gnu-debuglink
--- Additional Comments From Brian dot Ford at FlightSafety dot com 2006-01-24 18:42 --- (In reply to comment #9) binutils/ChangeLog 2006-01-18 Nick Clifton [EMAIL PROTECTED] PR binutils/1391 * objcopy.c (copy_object): For PE format targets set the VMA of a newly created gnu_debuglink section to a non-zero, aligned, contiguous value. * Makefile.am (objcopy.c): Add a dependency upon libbfd.h. * Makefile.in: Regenerate. Sorry. I was waiting to reply until I had a chance to test it, and time has been in short supply lately. Two questions though: Pedantically, doesn't this patch belong in bfd/opncls.c (bfd_create_gnu_debuglink_section)? I imagine objcopy is currently the only user of that function, but it seems to me like it is the wrong place for the fix. Although hackish, there is precedent in bfd/bfd.c (bfd_get_sign_extend_vma) to use name = bfd_get_target (abfd); if (strcmp (name, pei-i386) == 0) as the test for a PE image. Thanks for taking the time to look at it. -- http://sourceware.org/bugzilla/show_bug.cgi?id=1391 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug binutils/1391] objcopy trashes PE executable when using add-gnu-debuglink
--- Additional Comments From dannysmith at users dot sourceforge dot net 2006-01-18 01:40 --- (In reply to comment #7) Created an attachment (id=832) -- (http://sourceware.org/bugzilla/attachment.cgi?id=832action=view) Create a VMA for the gnu_debuglink section Almost. The section needs to be page-aligned. With this (and inclusion of 'libbfd.h'): if (highest_section) debuglink_vma = BFD_ALIGN (highest_section-vma + highest_section-size, 0x1000); I get good, debuggable exe's after going through the -add-gnu-dedug-link step. Danny -- http://sourceware.org/bugzilla/show_bug.cgi?id=1391 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug binutils/1391] objcopy trashes PE executable when using add-gnu-debuglink
--- Additional Comments From nickc at redhat dot com 2006-01-16 18:18 --- Created an attachment (id=832) -- (http://sourceware.org/bugzilla/attachment.cgi?id=832action=view) Create a VMA for the gnu_debuglink section -- http://sourceware.org/bugzilla/show_bug.cgi?id=1391 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug binutils/1391] objcopy trashes PE executable when using add-gnu-debuglink
--- Additional Comments From Brian dot Ford at FlightSafety dot com 2006-01-12 21:55 --- (In reply to comment #4) 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. It does matter. PE executables need contiguous section aligned VMAs. See: http://www.cygwin.com/ml/binutils/2003-01/msg00210.html -- http://sourceware.org/bugzilla/show_bug.cgi?id=1391 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug binutils/1391] objcopy trashes PE executable when using add-gnu-debuglink
--- Additional Comments From focht at gmx dot net 2005-10-04 08:43 --- Hello again, currently one can fix this manually by executing additional step: objcopy --change-section-vma .gnu_debuglink=+addr test_xxx.exe Where addr is the address of first debug section in objdump -h executable. That seems to work. The executable can be loaded and executed under cygwin x86/gcc 4.0.x toolchain and binutils 2.16.1* Gdb locates the external symbol file and loads it. 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? Regards, A. Focht -- http://sourceware.org/bugzilla/show_bug.cgi?id=1391 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug binutils/1391] objcopy trashes PE executable when using add-gnu-debuglink
--- Additional Comments From nickc at redhat dot com 2005-09-30 15:25 --- Subject: Re: New: objcopy trashes PE executable when using add-gnu-debuglink Hi, Idx Name Size VMA LMA File off Algn 0 .gnu_debuglink 0018 0268 2**2 When using a native win32 PE editor/format tool like LordPE it lists some crap for the first section (containing debug link), all other sections seem ok: Seems objcopy is messing up the PE section table while adding gnu debug link. I seem to recall that the PE file format does not allow sections to start at address 0 and that this causes problems for debug sections. Probably the simplest way to fix this problem is to amend the PE linker script (ld/scripttempl/pe.sc) and add an explicit entry for the .gnu_debuglink section. If this works, please could you submit a patch so that we can apply it to the mainline sources. Cheers Nick -- http://sourceware.org/bugzilla/show_bug.cgi?id=1391 --- You are receiving this mail because: --- You are on the CC list for the bug, or are watching someone who is. ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils