<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - std::tm type needs to be mangled as "::tm" on Solaris for g++ binary compat"
   href="https://bugs.llvm.org/show_bug.cgi?id=33767">33767</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>std::tm type needs to be mangled as "::tm" on Solaris for g++ binary compat
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Solaris
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>Fedor.Sergeev@oracle.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>g++ on Solaris has special mangling twist that makes it generate non-standard
mangling for std::tm, std::div_t, std::ldiv_t, std::lconv types.

W/o this twist clang fails to link with libstdc++ on testcases like this:

] cat no-tm.cc
#include <locale>
struct D : std::time_get<char> {};

int main() {
        D var;
        var.date_order();
}
] clang no-tm.cc
Undefined                       first referenced
 symbol                             in file
_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE11do_get_timeES3_S3_RSt8ios_baseRSt12_Ios_IostatePSt2tm
/var/tmp/no-tm-e5c67b.o
_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE11do_get_dateES3_S3_RSt8ios_baseRSt12_Ios_IostatePSt2tm
/var/tmp/no-tm-e5c67b.o
_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14do_get_weekdayES3_S3_RSt8ios_baseRSt12_Ios_IostatePSt2tm
/var/tmp/no-tm-e5c67b.o
_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE11do_get_yearES3_S3_RSt8ios_baseRSt12_Ios_IostatePSt2tm
/var/tmp/no-tm-e5c67b.o
_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE16do_get_monthnameES3_S3_RSt8ios_baseRSt12_Ios_IostatePSt2tm
/var/tmp/no-tm-e5c67b.o
ld: fatal: symbol referencing errors
clang-5.0: error: linker command failed with exit code 1 (use -v to see
invocation)
]

Basically any signature that includes either of the aforementioned types is
mangled differently than whats in libstdc++.

Namely, clang mangles std::tm as std::tm (surpise! :), while gcc does it as
::tm.

Say, first undefined symbol above:

] nm /usr/lib/libstdc++.so | grep
_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE11do_get_timeES3_S3_RSt8ios_baseRSt12_Ios_Iostate
[6646]  |    533632|       276|FUNC |WEAK |0    |810   
|_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE11do_get_timeES3_S3_RSt8ios_baseRSt12_Ios_IostateP2tm
]

Notice 2tm vs St2tm difference at the tail of the mangled name.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>