bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/20193] Invalid executable after adding debuglink to an exe


From: jon.turney at dronecode dot org.uk
Subject: [Bug binutils/20193] Invalid executable after adding debuglink to an executable produced after merging PE resource sections
Date: Fri, 03 Jun 2016 11:00:33 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=20193

--- Comment #4 from Jon TURNEY <jon.turney at dronecode dot org.uk> ---
Created attachment 9309
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9309&action=edit
Patch to update size of resources in DataDirectory

(In reply to Nick Clifton from comment #2)
> 
> > The size of the resources in the DataDirectory is not updated by 
> >  rsrc_process_section()
> 
>   Hmm, I wonder if that is it.  Does this, completely untested, patch make a
>   difference ?
> 
> Cheers
>   Nick
> 
> diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
> index c92c1ea..bb0e2c8 100644
> --- a/bfd/peXXigen.c
> +++ b/bfd/peXXigen.c
> @@ -4320,6 +4320,8 @@ rsrc_process_section (bfd * abfd,
>    bfd_set_section_contents (pfinfo->output_bfd, sec, new_data, 0, size);
>    sec->size = sec->rawsize = size;
>  
> +  pe->pe_opthdr.DataDirectory[PE_RESOURCE_TABLE].Size = size;
> +
>   end:
>    /* Step six: Free all the memory that we have used.  */
>    /* FIXME: Free the resource tree, if we have one.  */

This isn't quite enough to set the size of the DataDirectory correctly, I used
the attached instead.

Unfortunately, with that patch applied, 1.exe is invalid, while 2.exe and 3.exe
are good

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

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