From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail8.parnet.fi (mail8.parnet.fi [77.234.108.134]) by sourceware.org (Postfix) with ESMTPS id F29783858D37 for ; Tue, 23 Aug 2022 14:19:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F29783858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=martin.st Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=martin.st Received: from mail9.parnet.fi (mail9.parnet.fi [77.234.108.21]) by mail8.parnet.fi with ESMTP id 27NEJ4pd001499-27NEJ4pe001499; Tue, 23 Aug 2022 17:19:04 +0300 Received: from foo.martin.st (host-97-187.parnet.fi [77.234.97.187]) by mail9.parnet.fi (Postfix) with ESMTPS id B9B68A144B; Tue, 23 Aug 2022 17:19:03 +0300 (EEST) Date: Tue, 23 Aug 2022 17:19:02 +0300 (EEST) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: Nick Clifton cc: binutils@sourceware.org Subject: Re: [PATCH v2] ld: Make library member file suffix comparisons case insensitive when cross compiling too In-Reply-To: Message-ID: References: <20220823130606.1659316-1-martin@martin.st> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-FE-Policy-ID: 3:14:2:SYSTEM X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2022 14:19:12 -0000 On Tue, 23 Aug 2022, Nick Clifton wrote: > Hi Martin, > >> +/* 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 ? Oh, right - in general I guess that could be useful too, but all the occurrances I switched to use this only ever compared against filename suffixes, no full pathnames. So for the usecases changed here, stricmp as such is enough - but I guess I can extend it into a filename_dos_cmp instead, if that's preferred. // Martin