fprintf (file, _(" --build-id[=STYLE] Generate build ID\n"));
}
+/* A case insensitive comparison, regardless of the host platform, used for
+ comparing file extensions. */
+static int
+fileext_cmp (const char *s1, const char *s2)
+{
+ for (;;)
+ {
+ int c1 = TOLOWER (*s1++);
+ int c2 = *s2++; /* Assumed to be lower case from the caller. */
+
+ if (c1 != c2)
+ return (c1 - c2);
+
+ if (c1 == '\0')
+ return 0;
+ }
+}
static void
set_pe_name (char *name, long val)
extension, and use that for the remainder of the
comparisons. */
pnt = strrchr (bfd_get_filename (is3->the_bfd), '.');
- if (pnt != NULL && filename_cmp (pnt, ".dll") == 0)
+ if (pnt != NULL && fileext_cmp (pnt + 1, "dll") == 0)
break;
}
/* Skip static members, ie anything with a .obj
extension. */
pnt = strrchr (bfd_get_filename (is2->the_bfd), '.');
- if (pnt != NULL && filename_cmp (pnt, ".obj") == 0)
+ if (pnt != NULL && fileext_cmp (pnt + 1, "obj") == 0)
continue;
if (filename_cmp (bfd_get_filename (is3->the_bfd),
then leave the filename alone. */
pnt = strrchr (bfd_get_filename (is->the_bfd), '.');
- if (is_ms_arch && (filename_cmp (pnt, ".dll") == 0))
+ if (is_ms_arch && pnt != NULL && (fileext_cmp (pnt + 1, "dll") == 0))
{
int idata2 = 0, reloc_count=0;
asection *sec;
gld${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
{
#ifdef DLL_SUPPORT
- const char *ext = entry->filename + strlen (entry->filename) - 4;
+ const char *ext = strrchr (entry->filename, '.');
- if (filename_cmp (ext, ".def") == 0 || filename_cmp (ext, ".DEF") == 0)
+ if (ext != NULL && fileext_cmp (ext + 1, "def") == 0)
{
pe_def_file = def_file_parse (entry->filename, pe_def_file);
return pep_leading_underscore;
}
+/* A case insensitive comparison, regardless of the host platform, used for
+ comparing file extensions. */
+static int
+fileext_cmp (const char *s1, const char *s2)
+{
+ for (;;)
+ {
+ int c1 = TOLOWER (*s1++);
+ int c2 = *s2++; /* Assumed to be lower case from the caller. */
+
+ if (c1 != c2)
+ return (c1 - c2);
+
+ if (c1 == '\0')
+ return 0;
+ }
+}
static void
gld${EMULATION_NAME}_before_parse (void)
extension, and use that for the remainder of the
comparisons. */
pnt = strrchr (bfd_get_filename (is3->the_bfd), '.');
- if (pnt != NULL && filename_cmp (pnt, ".dll") == 0)
+ if (pnt != NULL && fileext_cmp (pnt + 1, "dll") == 0)
break;
}
/* Skip static members, ie anything with a .obj
extension. */
pnt = strrchr (bfd_get_filename (is2->the_bfd), '.');
- if (pnt != NULL && filename_cmp (pnt, ".obj") == 0)
+ if (pnt != NULL && fileext_cmp (pnt + 1, "obj") == 0)
continue;
if (filename_cmp (bfd_get_filename (is3->the_bfd),
then leave the filename alone. */
pnt = strrchr (bfd_get_filename (is->the_bfd), '.');
- if (is_ms_arch && (filename_cmp (pnt, ".dll") == 0))
+ if (is_ms_arch && pnt != NULL && (fileext_cmp (pnt + 1, "dll") == 0))
{
int idata2 = 0, reloc_count=0;
asection *sec;
gld${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED)
{
#ifdef DLL_SUPPORT
- const char *ext = entry->filename + strlen (entry->filename) - 4;
+ const char *ext = strrchr (entry->filename, '.');
- if (filename_cmp (ext, ".def") == 0 || filename_cmp (ext, ".DEF") == 0)
+ if (ext != NULL && fileext_cmp (ext + 1, "def") == 0)
{
pep_def_file = def_file_parse (entry->filename, pep_def_file);