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

Torbjorn SVENSSON torbjorn.svensson@foss.st.com
Mon Aug 15 11:38:20 GMT 2022


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
> 
> 


More information about the Binutils mailing list