!AW: ld --auto-import for cygwin and libtool

Ralf Habacker Ralf.Habacker@freenet.de
Mon Jul 23 13:23:00 GMT 2001

> On Mon, Jul 23, 2001 at 01:09:25PM -0400, Charles Wilson wrote:
> >Earnie Boyd wrote:
> >
> >> Christopher Faylor wrote:
> >>
> >>>It's possible that I might be convinced to include Paul's
> patches in the
> >>>next binutils release if they are not incorporated into the official
> >>>release.  However, I would rather use the official CVS release, if
> >>>possible.
> >>>
> >>>
> >>
> >> Don't be too hastily convinced.  I believe there to be problems of
> >> exporting too much in lots of cases.
> >
> >
> >Are we talking about Paul's --export-all-symbols/filtering changes, or
> >his auto-imports changes (Currently, both changes are commingled in a
> >single patch.  I think.)
> Actually, I think that Paul submitted the --export-all-symbols patch to
> binutils for approval, where it has languished for a while.
> He specifically did not include the auto-import stuff.  I don't remember
> if the auto-import patch also included export-all-symbols but I don't
> believe that the  converse is true.
In the binutils on which which Robert Collins has applied the auto-import
the --export-all-symbols switch is off. For compiling kde 1.1.2/kde 2 I have
set it, otherwise nothing will be exported.

Relating to this switch I have found a problem on using static libs.

The relating topic starts at

For kde 2 I have written a dirty hack to avoid this (don't export any
archive). This is no generic patch !!

While thinking about how to solve this problem I recognized, that there have
to be more
ld switches to restrict exporting symbols.

One proposal I think could be --export-whole-archive, which enables
exporting all object files/archives
beetwen it and --no-whole-archive or so.

What are you thinking about this ?


pe-dll.c (line with ! are new)

static int
auto_export (abfd, d, n)
     bfd *abfd;
     def_file *d;
     const char *n;
  int i;
  struct exclude_list_struct *ex;

  /* we should not re-export imported stuff */
  if (strncmp (n, "_imp__",6) == 0)
    return 0;

  for (i = 0; i < d->num_exports; i++)
    if (strcmp (d->exports[i].name, n) == 0)
      return 0;
  if (pe_dll_do_default_excludes)
      /* First of all, make context checks:
         Don't export anything from libgcc */

			if (pe_dll_gory_debug) printf("considering exporting: %s "
					"abfd=%x, abfd->my_arc=%x filename=%s\n",n,abfd,abfd->my_archive,abfd->

      if (abfd
          && abfd->my_archive)
				if (pe_dll_gory_debug) printf("considering exporting: %s "
					"abfd=%x, abfd->my_arc=%x filename=%s\n",n,abfd,abfd->my_archive,abfd->

!					/* don*'t export archives */
!					if (link_info.shared && strstr(abfd->my_archive->filename,".a")) {
!						return 0;
!					}
          /* Do not specify suffix explicitly, to allow for dllized versions
          if (strstr(abfd->my_archive->filename,"libgcc.")) return 0;
          if (strstr(abfd->my_archive->filename,"libstdc++.")) return 0;
          if (strstr(abfd->my_archive->filename,"libmingw32.")) return 0;


More information about the Cygwin-apps mailing list