[Patch/pe-coff] : Add native spelling of import lib names to dynamic lib search

Nick Clifton nickc@redhat.com
Tue Jun 27 14:57:00 GMT 2006


Hi Pedro,

>>> This doesn't work correctly. The sizeof (libname_fmt.format) is 
>>> sizeof (const char*), not the sizeof the string.

Doh - and on the 64-bit machine I was using for testing the size was 8 
and so I did not notice any memory leaks.  Sorry about that.

> Sorry for generating a lot of noise, but it seems the patch got mangled 
> up, because I accidently posted as html.
> Here goes the same patch an an attached gzip.

Thanks.  I am still not happy with the static values for the lengths - 
it is too easy to make a mistake and put a wrong value here.  I think 
that the overhead of calling strlen() on the format strings in the array 
is not going to be very big, so it is safer to compute the maximum 
length at run time.  Thus I am going to apply the attached variation of 
your patch instead.

Cheers
   Nick

ld/ChangeLog
2006-06-27  Pedro Alves  <pedro_alves@portugalmail.pt>
	    Nick Clifton  <nickc@redhat.com>

	* emultempl/pe.em (gld_$_open_dynamic_archive): Compute maximum
	length of format strings in the libname_fmt[] array, rather than
	relying upon a statically chosen value.  Adjust xmalloc call to
	use this longest length.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pe.em.patch
Type: text/x-patch
Size: 2604 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060627/30bae4d1/attachment.bin>


More information about the Binutils mailing list