-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang] Fix std::tm etc. mangling on Solaris #106353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1604,10 +1604,12 @@ static bool isTargetVariantEnvironment(const TargetInfo &TI, | |
| return false; | ||
| } | ||
|
|
||
| #if defined(__sun__) && defined(__svr4__) | ||
| #if defined(__sun__) && defined(__svr4__) && defined(__clang__) && \ | ||
| __clang__ < 20 | ||
|
Comment on lines
+1607
to
+1608
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does every version of gcc we support handles that?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Certainly: the fix for GCC PR libstdc++-v3/1773 went in 13 years ago. That should be good enough ;-) |
||
| // GCC mangles std::tm as tm for binary compatibility on Solaris (Issue | ||
| // #33114). We need to match this to allow the std::put_time calls to link | ||
| // (PR #99075). | ||
| // (PR #99075). clang 20 contains a fix, but the workaround is still needed | ||
| // with older versions. | ||
| asm("_ZNKSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE3putES3_" | ||
| "RSt8ios_basecPKSt2tmPKcSB_ = " | ||
| "_ZNKSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE3putES3_" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /// Check that std::tm and a few others are mangled as tm on Solaris only. | ||
| /// Issue #33114. | ||
| /// | ||
| // RUN: %clang_cc1 -emit-llvm %s -o - -triple amd64-pc-solaris2.11 | FileCheck --check-prefix=CHECK-SOLARIS %s | ||
| // RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-unknown-linux-gnu | FileCheck --check-prefix=CHECK-LINUX %s | ||
| // | ||
| // REQUIRES: x86-registered-target | ||
| // | ||
| // CHECK-SOLARIS: @_Z6tmfunc2tm | ||
| // CHECK-SOLARIS: @_Z7ldtfunc6ldiv_t | ||
| // CHECK-LINUX: @_Z6tmfuncSt2tm | ||
| // CHECK-LINUX: @_Z7ldtfuncSt6ldiv_t | ||
|
|
||
| namespace std { | ||
| extern "C" { | ||
| struct tm { | ||
| int tm_sec; | ||
| }; | ||
| struct ldiv_t { | ||
| long quot; | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| void tmfunc (std::tm tm) {} | ||
|
|
||
| void ldtfunc (std::ldiv_t ldt) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using a std::set is a bit overkill here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do: I'm pretty ignorant of C++ actually...