-
-
Notifications
You must be signed in to change notification settings - Fork 613
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
druntime: redirect dual-ABI functions on glibc to IEEE128 version #20826
base: master
Are you sure you want to change the base?
Conversation
... if IEEE long double ABI is selected
Thanks for your pull request and interest in making D better, @liushuyu! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#20826" |
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.
please use aliases instead of pragma(mangle, ...)
, like:
pragma(scanf)
int __isoc99_scanf(scope const char* format, scope ...);
///
alias scanf = __isoc99_scanf;
``
I don't know if I understand you correctly, but extern (C) void a();
version (PPC64) {
static if (real.mant_dig == 113) {
extern (C) void a__ieee128();
alias a = a__ieee128;
}
}
void b() {
a();
} This does not work. |
Assuming we can't do anything about the version (PPC64)
enum PPCUseIEEE128 = real.mant_dig == 113;
else
enum PPCUseIEEE128 = false;
static if (PPCUseIEEE128)
{
real __strtoieee128(scope inout(char)* nptr, scope inout(char)** endptr);
alias strtold = __strtoieee128;
}
else
{
real strtold(scope inout(char)* nptr, scope inout(char)** endptr);
} ... which is a bit verbose for |
You only need to have one |
I know, but my concern is that declaring each function twice may increase maintenance burden (both versions have the same D function signature), as opposed to using |
This pull request redirects
powerpc
dual-ABI functions on glibc to the IEEE128 version if IEEE long double ABI is selected.A new (reserved) version identifier,
D_PPCUseIEEE128
, is introduced to control the redirection behaviour. Compilers are expected to set this version identifier when the user selects IEEE 128 ABI for their project.Required compiler changes (setting the
D_PPCUseIEEE128
identifier) are also proposed in the following: