aboutsummaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorChristopher Faylor <me+cygwin@cgf.cx>2002-05-22 18:03:09 +0000
committerChristopher Faylor <me+cygwin@cgf.cx>2002-05-22 18:03:09 +0000
commit70b0be790399493084660877bf2cfeae26c61117 (patch)
treeeff851bbfc460723fcabdf9273b1437f63acc41d /ld/pe-dll.c
parent76feaaf3597dd644456717109f9268006c24bb6c (diff)
downloadgdb-70b0be790399493084660877bf2cfeae26c61117.zip
gdb-70b0be790399493084660877bf2cfeae26c61117.tar.gz
gdb-70b0be790399493084660877bf2cfeae26c61117.tar.bz2
* pe-dll.c (autofilter_liblist): Add more system libs excluded by default.
(autofilter_objlist): Add crtbegin.o, crtend.o. * emultempl/pe.em (OPTION_EXCLUDE_LIBS): Add new define. (longopts): Add new option --exclude-libs. (gld_${EMULATION_NAME}_list_options): Give quick help about it. (gld_${EMULATION_NAME}_parse_args): Use it. * pe-dll.h (pe_dll_add_excludes): Add second param to prototype. * pe-dll.c (exclude_list_struct): Add field type to distinguish symbols from whole archives. (pe_dll_add_excludes): Set excludes->type. (auto_export): Add new variable libname and set to archive basename if abfd. Use it when filtering default and user-specified libarary excludes. Let string "ALL" mean all libs when filtering user-specified libs. * ld.texinfo: Document --exclude-libs.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index 51780c4..62c452c 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -231,6 +231,9 @@ static autofilter_entry_type autofilter_liblist[] =
{ "libgcc.", 7 },
{ "libstdc++.", 10 },
{ "libmingw32.", 11 },
+ { "libg2c.", 7 },
+ { "libsupc++.", 10 },
+ { "libobjc.", 8 },
{ NULL, 0 }
};
@@ -244,6 +247,8 @@ static autofilter_entry_type autofilter_objlist[] =
{ "gcrt0.o", 7 },
{ "gcrt1.o", 7 },
{ "gcrt2.o", 7 },
+ { "crtbegin.o", 10 },
+ { "crtend.o", 8 },
{ NULL, 0 }
};
@@ -368,14 +373,16 @@ typedef struct exclude_list_struct
{
char *string;
struct exclude_list_struct *next;
+ int type;
}
exclude_list_struct;
static struct exclude_list_struct *excludes = 0;
void
-pe_dll_add_excludes (new_excludes)
+pe_dll_add_excludes (new_excludes, type)
const char *new_excludes;
+ const int type;
{
char *local_copy;
char *exclude_string;
@@ -391,6 +398,7 @@ pe_dll_add_excludes (new_excludes)
xmalloc (sizeof (struct exclude_list_struct)));
new_exclude->string = (char *) xmalloc (strlen (exclude_string) + 1);
strcpy (new_exclude->string, exclude_string);
+ new_exclude->type = type;
new_exclude->next = excludes;
excludes = new_exclude;
}
@@ -398,6 +406,7 @@ pe_dll_add_excludes (new_excludes)
free (local_copy);
}
+
/* abfd is a bfd containing n (or NULL)
It can be used for contextual checks. */
@@ -410,6 +419,9 @@ auto_export (abfd, d, n)
int i;
struct exclude_list_struct *ex;
autofilter_entry_type *afptr;
+ const char * libname = 0;
+ if (abfd && abfd->my_archive)
+ libname = lbasename (abfd->my_archive->filename);
/* We should not re-export imported stuff. */
if (strncmp (n, "_imp__", 6) == 0)
@@ -429,14 +441,14 @@ auto_export (abfd, d, n)
n, abfd, abfd->my_archive);
/* First of all, make context checks:
- Don't export anything from libgcc. */
- if (abfd && abfd->my_archive)
+ Don't export anything from standard libs. */
+ if (libname)
{
afptr = autofilter_liblist;
while (afptr->name)
{
- if (strstr (abfd->my_archive->filename, afptr->name))
+ if (strncmp (libname, afptr->name, afptr->len) == 0 )
return 0;
afptr++;
}
@@ -495,8 +507,17 @@ auto_export (abfd, d, n)
}
for (ex = excludes; ex; ex = ex->next)
- if (strcmp (n, ex->string) == 0)
- return 0;
+ {
+ if (ex->type == 1) /* exclude-libs */
+ {
+ if (libname
+ && ((strcmp (libname, ex->string) == 0)
+ || (strcasecmp ("ALL", ex->string) == 0)))
+ return 0;
+ }
+ else if (strcmp (n, ex->string) == 0)
+ return 0;
+ }
return 1;
}