This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH-bfd] i386-mingw32-ld crash on x86_64 linux


On Tue, Apr 14, 2009 at 06:43:32PM +0100, Dave Korn wrote:
> Peter O'Gorman wrote:
> > Later in the same function there is: if (strcmp (sec->name, in->n_name) ==
> > 0)
> > 
> > So that would need to change to strncmp, with luck that is the only place
> > that expects n_name to be null terminated.
> 
>   Ouch, looks like you've opened a can of worms here, I've spotted a couple
> more already.  I'll have a good read through the file.

Simply changing that one strcmp to strncmp eliminates the crash, but the
output differs from the same link done on i686 linux (we don't have
source code, or a way to test the output, so cmp is the only check we
have).

On x86_64 the union is 16 bytes long, because bfd_hostptr_t is an
unsigned long. If we zero the _n_zeroes and _n_offset members before we
do the memcpy, then the output on x86_64 is identical to that on i686.

Is this patch more acceptable?

Thank you,
Peter
-- 
Peter O'Gorman
pogma@thewrittenword.com

Attachment: bfd_peXXigen.c.better.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]