[llvm-bugs] [Bug 33767] New: std::tm type needs to be mangled as "::tm" on Solaris for g++ binary compat

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 13 04:41:44 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33767

            Bug ID: 33767
           Summary: std::tm type needs to be mangled as "::tm" on Solaris
                    for g++ binary compat
           Product: clang
           Version: unspecified
          Hardware: All
                OS: Solaris
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Fedor.Sergeev at oracle.com
                CC: llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170713/90dd6824/attachment.html>


More information about the llvm-bugs mailing list