[PATCH][_GLIBCXX_INLINE_VERSION] Adapt to_chars/from_chars symbols

François Dumont frs.dumont@gmail.com
Mon Nov 28 18:45:27 GMT 2022


I forgot to add the patch but as you already made another feedback I'll 
clean my patch first.


On 28/11/22 19:43, François Dumont wrote:
> On 28/11/22 11:21, Jonathan Wakely wrote:
>>
>>
>> On Mon, 28 Nov 2022 at 10:10, Jonathan Wakely <jwakely@redhat.com> wrote:
>>
>>
>>
>>     On Mon, 28 Nov 2022 at 06:07, François Dumont via Libstdc++
>>     <libstdc++@gcc.gnu.org <mailto:libstdc%2B%2B@gcc.gnu.org>> wrote:
>>
>>         This patch is fixing those tests:
>>
>>         20_util/to_chars/float128_c++23.cc
>>         std/format/formatter/requirements.cc
>>         std/format/functions/format.cc
>>         std/format/functions/format_to_n.cc
>>         std/format/functions/size.cc
>>         std/format/functions/vformat_to.cc
>>         std/format/string.cc
>>
>>         Note that symbols used in <format> for __ibm128 and __iee128
>>         are untested.
>>
>>         I even wonder if the normal mode ones are because I cannot
>>         find the
>>         symbols used in gnu.ver.
>>
>>
>>              libstdc++: [_GLIBCXX_INLINE_VERSION] Add
>>         to_chars/from_chars
>>         symbols export
>>
>>              libstdc++-v3/ChangeLog
>>
>>                      * include/std/format
>>         [_GLIBCXX_INLINE_VERSION](to_chars):
>>         Adapt __asm symbol
>>                      specifications.
>>                      * config/abi/pre/gnu-versioned-namespace.ver: Add
>>         to_chars/from_chars symbols
>>                      export.
>>
>>         Ok to commit ?
>>
>>
>>
>>     Why are changes needed to the linker script?
>>
>>     Those functions should already match the general wildcard:
>>
>>         # Names inside the 'extern' block are demangled names.
>>         extern "C++"
>>         {
>>           std::*;
>>           std::__8::*;
>>         };
>>
>>
>>
> No idear, my guess was that it has something to do with the __asm 
> usages in <format> and with the commnt:
>
>   // These overloads exist in the library, but are not declared for C++20.
>   // Make them available as std::__format::to_chars.
>
> Maybe they exist in the library but are unused so not exported unless 
> specified in the linker script ?
>
>
>>
>> Instead of nine separate #if blocks, can we just do:
>>
>> #if _GLIBCXX_INLINE_VERSION
>> # define _GLIBCXX_ALIAS(S) __asm("_ZNSt3__8" S)
>> #else
>> # define _GLIBCXX_ALIAS(S) __asm("_ZNSt" S)
>> #endif
>>
>>  And then use:
>>
>>   _GLIBCXX_ALIAS("8to_charsPcS_eSt12chars_format");
>>
>> and finally:
>>
>> #undef _GLIBCXX_ALIAS
>>
>>
> I tried and as expected it's not working because the diff in the 
> symbol is not limited to the '3__8' pattern. 'chars_format' is also 
> defined in versioned namespace which might perhaps explain some 
> mangling diff.
>
> Here is an updated patch though, I had forgotten to replace a _DF128 
> with a __ieee128 in the untested part of this patch.
>
> If you prefer to take a closer look later I'll just re-submit my patch 
> to move versioned namespace mode to cxx11 abi knowing that those tests 
> are already FAIL.
>
> François
>
>


More information about the Libstdc++ mailing list