This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Patch/PE-COFF: Provide default suffix to NAME or LIBRARY names in .def files
- From: Danny Smith <danny_smith_0000 at yahoo dot co dot nz>
- To: binutils <binutils at sources dot redhat dot com>
- Date: Wed, 1 Feb 2006 13:29:38 +1300 (NZDT)
- Subject: Patch/PE-COFF: Provide default suffix to NAME or LIBRARY names in .def files
- Reply-to: dannysmith at users dot sourceforge dot net
Hello
According to MS doc's (and comments in binutils/dlltool.c). the suffix
of the internal names of images defaults to ".exe" if the name is
specified by NAME statement in a .def file, and to ".dll" if specified
by a LIBRARY statement. Failing to append a suffix can cause dll
import problems since it is this internal name that is put into the
import lib and used when searching for the libary at load time. An
example of this problem is at:
https://sourceforge.net/tracker/index.php?func=detail&aid=1401442&group_id=2435&atid=102435
This fixes by appending a default suffix, if necessary, when we parse
the .def file.
ChangeLog
2006-02-01 Danny Smith <dannysmith@users.sourceforge.net>
* deffilep.y (def_image_name): If the image name does not have a
suffix, append the default.
*ld.texinfo: Document NAME, LIBRARY usage in PE-COFF .def files.
Index: deffilep.y
===================================================================
RCS file: /cvs/src/src/ld/deffilep.y,v
retrieving revision 1.20
diff -c -3 -p -r1.20 deffilep.y
*** deffilep.y 12 May 2005 07:32:02 -0000 1.20
--- deffilep.y 31 Jan 2006 22:02:00 -0000
*************** def_image_name (const char *name, int ba
*** 654,660 ****
def_filename, linenumber, is_dll ? "LIBRARY" : "NAME", name);
if (def->name)
free (def->name);
! def->name = xstrdup (image_name);
def->base_address = base;
def->is_dll = is_dll;
}
--- 654,669 ----
def_filename, linenumber, is_dll ? "LIBRARY" : "NAME", name);
if (def->name)
free (def->name);
! /* Append the default suffix, if none specified. */
! if (strchr (image_name, '.') == 0)
! {
! int len = strlen (image_name);
! def->name = xmalloc (len + 5);
! memcpy (def->name, image_name, len);
! memcpy (def->name + len, is_dll ? ".dll\0" : ".exe\0", 5);
! }
! else
! def->name = xstrdup (image_name);
def->base_address = base;
def->is_dll = is_dll;
}
Send instant messages to your online friends http://au.messenger.yahoo.com