[clang] [clang] Handle tm mangling on Solaris in PPMacroExpansion.cpp (PR #100724)

Rainer Orth via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 05:18:29 PDT 2024


rorth wrote:

> Thank you for helping out with this odd edge case! I don't suppose there's a way we can shove this hack into CMake (basically, like a kind of linker script hack)? If so, can we apply it broadly enough so that any use of `time_put` in other TUs will also benefit?

This would have to apply to all instances of `std::tm`, so I cannot say if this is feasible at all.  Besides, `clang` on Solaris supports both Solaris `ld` and GNU `ld`, which have different linker script syntax, duplicating the code if in fact both support the renaming.

This all seems like a waste of time to me.

> (If there are better alternatives than this approach, I'd love to hear about them, this is a pretty gnarly way to go about working around the issue.)

I believe `clang` should something like `g++` to handle the mangling difference itself.  On the `g++` side of things, there's the `TARGET_CXX_DECL_MANGLING_CONTEXT` target hook, implemented for Solaris in `gcc/config/sol2-cxx.cc` (`solaris_cxx_decl_mangling_context`) and applied in `gcc/cp/mangle.cc` (`decl_mangling_context`) where it is called as `targetm.cxx.decl_mangling_context`.

As I've mentioned before, I've no idea where to do something similar in `clang`.  I believe that would be `clang/lib/CodeGen`

Whatever the case, we need at least a short-term solution now: the Solaris buildbots have been broken for two days now.


https://github.com/llvm/llvm-project/pull/100724


More information about the cfe-commits mailing list