This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
pe: auto-import data from dll
- To: binutils at sources dot redhat dot com
- Subject: pe: auto-import data from dll
- From: DJ Delorie <dj at delorie dot com>
- Date: Mon, 17 Jul 2000 14:44:17 -0400
- CC: cgf at cygnus dot com
I just checked this in, which should allow programs which link
directly against a DLL to reference data items as well as functions.
2000-07-17 DJ Delorie <dj@cygnus.com>
* pe-dll.c (process_def_file): auto-export data items also
(pe_process_import_defs): also see if _imp_ form needed
Index: pe-dll.c
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.c,v
retrieving revision 1.12
diff -p -2 -r1.12 pe-dll.c
*** pe-dll.c 2000/07/13 00:51:40 1.12
--- pe-dll.c 2000/07/17 18:37:00
*************** process_def_file (abfd, info)
*** 302,307 ****
for (j = 0; j < nsyms; j++)
{
! if ((symbols[j]->flags & (BSF_FUNCTION | BSF_GLOBAL))
! == (BSF_FUNCTION | BSF_GLOBAL))
{
const char *sn = symbols[j]->name;
--- 302,306 ----
for (j = 0; j < nsyms; j++)
{
! if (symbols[j]->flags & BSF_GLOBAL)
{
const char *sn = symbols[j]->name;
*************** pe_process_import_defs (output_bfd, link
*** 1662,1669 ****
/* see if we need this import */
! char *name = (char *) xmalloc (strlen (pe_def_file->imports[i].internal_name) + 2);
sprintf (name, "%s%s", U(""), pe_def_file->imports[i].internal_name);
blhe = bfd_link_hash_lookup (link_info->hash, name,
false, false, false);
free (name);
if (blhe && blhe->type == bfd_link_hash_undefined)
--- 1661,1675 ----
/* see if we need this import */
! char *name = (char *) xmalloc (strlen (pe_def_file->imports[i].internal_name) + 2 + 6);
sprintf (name, "%s%s", U(""), pe_def_file->imports[i].internal_name);
blhe = bfd_link_hash_lookup (link_info->hash, name,
false, false, false);
+ if (!blhe || (blhe && blhe->type != bfd_link_hash_undefined))
+ {
+ sprintf (name, "%s%s", U("_imp__"),
+ pe_def_file->imports[i].internal_name);
+ blhe = bfd_link_hash_lookup (link_info->hash, name,
+ false, false, false);
+ }
free (name);
if (blhe && blhe->type == bfd_link_hash_undefined)