This is the mail archive of the binutils@sources.redhat.com 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 for ld on cygwin: avoid core dump when linked-to DLL has no exports


[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


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