[clang] [clang] replaced the usage of `asctime` with `std::put_time` (PR #99075)
Rainer Orth via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 25 05:21:52 PDT 2024
rorth wrote:
> If you dump the symbols from the STL shared library on the system, is there one for `time_put` at all? If so, what is the mangled symbol it exports?
While the source requires
```
_ZNKSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE3putES3_RSt8ios_basecPKSt2tmPKcSB_
std::time_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, std::tm const*, char const*, char const*) const
```
`libstdc++.so.6` only provides
```
_ZNKSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE3putES3_RSt8ios_basecPK2tmPKcSB_
std::time_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, tm const*, char const*, char const*) const
```
i.e. `tm const *` instead of `std::tm const *`.
>
> (As a perhaps terrible idea, could we use the `alias` attribute on a redeclaration to try to force to link against the correct mangling for Solaris only?)
A hack along the lines of
```
asm("_ZNKSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE3putES3_RSt8ios_basecPKSt2tmPKcSB_ = _ZNKSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE3putES3_RSt8ios_basecPK2tmPKcSB_");
```
at least allows `clang` to link.
https://github.com/llvm/llvm-project/pull/99075
More information about the cfe-commits
mailing list