aboutsummaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorDave Korn <dave.korn@artimi.com>2009-01-03 17:43:45 +0000
committerDave Korn <dave.korn@artimi.com>2009-01-03 17:43:45 +0000
commit81b07b162c1b6d9ec524b0bbc481a39de74a4d2d (patch)
tree680c331b345553f7db98aed3fcd580120a21f375 /ld/pe-dll.c
parent9dbe8890140f5769a862c4ad6c88ac7a7aa4ed17 (diff)
downloadgdb-81b07b162c1b6d9ec524b0bbc481a39de74a4d2d.zip
gdb-81b07b162c1b6d9ec524b0bbc481a39de74a4d2d.tar.gz
gdb-81b07b162c1b6d9ec524b0bbc481a39de74a4d2d.tar.bz2
2009-01-03 Dave Korn <dave.korn.cygwin@gmail.com>
* pe-dll.c (autofilter_liblist): Add entry for shared libgcc. (libnamencmp): New function. (auto_export): Use it in place of strncmp when filtering libraries. Also rolled over ChangeLog to ChangeLog-2008
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index f5aa9dd..de43e34 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -314,6 +314,7 @@ static const autofilter_entry_type autofilter_liblist[] =
{ STRING_COMMA_LEN ("libcegcc") },
{ STRING_COMMA_LEN ("libcygwin") },
{ STRING_COMMA_LEN ("libgcc") },
+ { STRING_COMMA_LEN ("libgcc_s") },
{ STRING_COMMA_LEN ("libstdc++") },
{ STRING_COMMA_LEN ("libmingw32") },
{ STRING_COMMA_LEN ("libmingwex") },
@@ -324,6 +325,37 @@ static const autofilter_entry_type autofilter_liblist[] =
{ NULL, 0 }
};
+/* Regardless of the suffix issue mentioned above, we must ensure that
+ we do not falsely match on a leading substring, such as when libtool
+ builds libstdc++ as a DLL using libsupc++convenience.a as an intermediate.
+ This routine ensures that the leading part of the name matches and that
+ it is followed by only an optional version suffix and a file extension,
+ returning zero if so or -1 if not. */
+static int libnamencmp (const char *libname, const autofilter_entry_type *afptr)
+{
+ if (strncmp (libname, afptr->name, afptr->len))
+ return -1;
+
+ libname += afptr->len;
+
+ /* Be liberal in interpreting what counts as a version suffix; we
+ accept anything that has a dash to separate it from the name and
+ begins with a digit. */
+ if (libname[0] == '-')
+ {
+ if (!ISDIGIT (*++libname))
+ return -1;
+ /* Ensure the filename has an extension. */
+ while (*++libname != '.')
+ if (!*libname)
+ return -1;
+ }
+ else if (libname[0] != '.')
+ return -1;
+
+ return 0;
+}
+
static const autofilter_entry_type autofilter_objlist[] =
{
{ STRING_COMMA_LEN ("crt0.o") },
@@ -501,7 +533,7 @@ auto_export (bfd *abfd, def_file *d, const char *n)
while (afptr->name)
{
- if (strncmp (libname, afptr->name, afptr->len) == 0 )
+ if (libnamencmp (libname, afptr) == 0 )
return 0;
afptr++;
}