[PATCH v2] ld: Make library member file suffix comparisons case insensitive when cross compiling too

Jan Beulich jbeulich@suse.com
Tue Aug 23 14:23:59 GMT 2022


On 23.08.2022 16:01, Nick Clifton via Binutils wrote:
>> +/* Hardcoded case insensitive comparison. filename_cmp is insensitive
>> + * when running on Windows, but when cross compiling to Windows, we
>> + * also want similar comparisons to be case insensitive. */
>> +static int stricmp (const char *s1, const char *s2)
>> +{
>> +  for (;;)
>> +    {
>> +      int c1 = TOLOWER (*s1++);
>> +      int c2 = TOLOWER (*s2++);
>> +
>> +      if (c1 != c2)
>> +        return (c1 - c2);
>> +
>> +      if (c1 == '\0')
>> +        return 0;
>> +    }
>> +}
> 
> The implementation of filename_cmp() in libiberty also treats forward
> slashes and backward slashes as the same, on DOS based filesystems.
> Shouldn't this be carried over to stricmp() as well ?

Well, the function is used on filename extensions (.dll and alike) only,
so that shouldn't be necessary. But I think the function would want to
have a name expressing this very limited purpose, and the comment ahead
of it would also want to call this out.

Jan


More information about the Binutils mailing list