This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH for ld on cygwin: avoid core dump when linked-to DLL has no exports
- From: Christopher Faylor <cgf at redhat dot com>
- To: binutils at sources dot redhat dot com
- Cc: offby1 at blarg dot net
- Date: Sat, 10 May 2003 12:13:49 -0400
- Subject: Re: PATCH for ld on cygwin: avoid core dump when linked-to DLL has no exports
- References: <87wuhbzutt.fsf@blarg.net>
- Reply-to: binutils at sourceware dot org
[Reply-to set. Please honor.]
On Wed, Apr 30, 2003 at 11:47:10AM -0700, Eric Hanchrow wrote:
>
>This patch works around, or perhaps even fixes, a problem that I
>recently had. I was trying to link against a DLL that (by accident)
>had no exports, like this:
>
> ld sans_exports.dll
>
>I was seeing a seg fault as the linker was attempting to read from
>`expdata', even though that pointed to uninitialized memory.
>
>I'm not certain that this is the best solution, but it seems
>reasonable.
I was going to apply this patch but I noticed that there is already provision
in the code for DLLs without exports:
/* Get pe_header, optional header and numbers of export entries. */
pe_header_offset = pe_get32 (dll, 0x3c);
opthdr_ofs = pe_header_offset + 4 + 20;
num_entries = pe_get32 (dll, opthdr_ofs + 92);
if (num_entries < 1) /* No exports. */
return FALSE;
Do you know why this isn't sufficient? Is there something special about your
DLL?
cgf