summaryrefslogtreecommitdiff
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
commita0304b950c294f40cfa3e1ce5a5a5076c95da167 (patch)
tree9512b5fe17ebfc2bd72ec5daae9e1499539f54f5 /ld/pe-dll.c
parent6c696afe3163e809ed9f8cb111810a054f96fa06 (diff)
downloadbinutils-redhat-a0304b950c294f40cfa3e1ce5a5a5076c95da167.tar.gz
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 f5aa9dd19c..de43e34329 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++;
}