[PATCH] bfd: handle codepage when opening files on MinGW

Luis Machado luis.machado@arm.com
Tue Aug 16 12:15:17 GMT 2022

Hi Nick,

On 8/15/22 12:38, Torbjorn SVENSSON wrote:
> Hello Nick,
> On 2022-08-15 13:07, Nick Clifton wrote:
>> Hi Luis,
>>> In fact, trying to build master binutils-gdb with Ubuntu 22.04's mingw-w64 8.0 or Ubuntu 20.04's mingw-w64 7.0.0 runs
>>> into the following:
>>> bfd/bfdio.c: In function ‘_bfd_real_fopen’:
>>> bfd/bfdio.c:125:28: error: implicit declaration of function ‘___lc_codepage_func’ [-Werror=implicit-function-declaration]
>>>    125 |    const unsigned int cp = ___lc_codepage_func();
>> So that would imply a missing #include of a system header, yes ?
>> Do you know which header provides the required prototype ?
>> The code is currently conditional upon __MINGW32__ being defined.  Perhaps
>> that check needs to be extended/changed to reference a different preprocessor
>> symbol ?
> The problem is that the function is not exposed in the MinGW headers until the 9.0 release.
> I sent a patch that fixes the build error https://sourceware.org/pipermail/binutils/2022-August/122423.html earlier today (with you on CC).
>> Cheers
>>    Nick

What Torbjörn said. We need to restrict things based on the version of MinGW.

His patch looks good to me. I just wasn't sure about the _CRTIMP in his patch.

More information about the Binutils mailing list