From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by sourceware.org (Postfix) with ESMTPS id 89CE03858032 for ; Mon, 15 Aug 2022 10:19:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 89CE03858032 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27F7Y2sp020665; Mon, 15 Aug 2022 12:19:39 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3hx2uh925e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Aug 2022 12:19:39 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D711C10002A; Mon, 15 Aug 2022 12:19:36 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id AC556222C8F; Mon, 15 Aug 2022 12:19:36 +0200 (CEST) Received: from [10.252.10.170] (10.75.127.46) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.20; Mon, 15 Aug 2022 12:19:35 +0200 Message-ID: <77e4a360-fa17-e9e6-5e7e-3fc63dd39f0c@foss.st.com> Date: Mon, 15 Aug 2022 12:19:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH] bfd: Define func prototype for old mingw Content-Language: en-US To: Luis Machado , References: <20220815084902.3630298-1-torbjorn.svensson@foss.st.com> <503a5a7b-4e94-105f-5242-5364b6d49701@arm.com> From: Torbjorn SVENSSON In-Reply-To: <503a5a7b-4e94-105f-5242-5364b6d49701@arm.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-15_06,2022-08-15_01,2022-06-22_01 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, NICE_REPLY_A, 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: Mon, 15 Aug 2022 10:19:47 -0000 On 2022-08-15 12:01, Luis Machado wrote: > Just some nits... > On 8/15/22 09:49, Torbjörn SVENSSON wrote: >> In commit 68e80d96a84282d547f3b3c1234c99009521630c, the usage of >> ___lc_codepage_func was introduced to determine the current encoding. >> Prior to version 9.0 of MinGW-w64, the function prototype for >> ___lc_codepage_func was missing and caused >> error: implicit declaration of function ‘___lc_codepage_func’ >> when building.  This changeset adds a conditonal definition of >> ___lc_codepage_func to allow a sucessful build with MinGW-w64. > > sucessful -> successful >> >> Signed-off-by: Torbjörn SVENSSON >> --- >>   bfd/bfdio.c | 5 +++++ >>   1 file changed, 5 insertions(+) >> >> diff --git a/bfd/bfdio.c b/bfd/bfdio.c >> index a7c7d5bd363..59f79203b88 100644 >> --- a/bfd/bfdio.c >> +++ b/bfd/bfdio.c >> @@ -29,6 +29,11 @@ >>   #if defined (_WIN32) >>   #include >>   #include >> + >> +#if defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR < 9 >> +/* This prototype was added to locale.h in version 9.0 of >> MinaGW-w64.  */ > > MinaGW-w64 -> MinGW-w64 >> +_CRTIMP unsigned int __cdecl ___lc_codepage_func(void); > > I don't see any occurrences of CRTIMP in binutils-gdb. Should we not use > that? I'm not entirely sure if it's needed or not, but it's part of the official mingw definition at https://github.com/mirror/mingw-w64/blob/v9.0.0/mingw-w64-headers/crt/locale.h. From what I can tell, the _CRTIMP will expand to __declspec(dllimport). When the prototype is defined with _CRTIMP, then the call will be made using the symbol __imp____lc_codepage_func instead of a direct function call. I'm guessing this is something similar to the .got table in ELF files. Are there other function prototypes added in binutils code that is implemented in mingw? > >> +#endif >>   #endif >>   #ifndef S_IXUSR >