2019-09-03 19:06:03 +02:00
|
|
|
diff --git a/dmd/dmangle.d b/dmd/dmangle.d
|
|
|
|
index 8e2fc5b6f..7de4a02de 100644
|
|
|
|
--- a/dmd/dmangle.d
|
|
|
|
+++ b/dmd/dmangle.d
|
|
|
|
@@ -926,7 +926,10 @@ public:
|
|
|
|
|
|
|
|
char[36] buffer = void;
|
|
|
|
// 'A' format yields [-]0xh.hhhhp+-d
|
|
|
|
- const n = CTFloat.sprint(buffer.ptr, 'A', value);
|
|
|
|
+ // sprintf/printf with hex formatting is broken for certain long
|
|
|
|
+ // doubles on Android/x64, so use decimal format instead.
|
|
|
|
+ char fmt = global.params.isAndroidX86_64 ? 'g' : 'A';
|
|
|
|
+ const n = CTFloat.sprint(buffer.ptr, fmt, value);
|
|
|
|
assert(n < buffer.length);
|
|
|
|
foreach (const c; buffer[2 .. n])
|
|
|
|
{
|
2018-12-17 08:01:31 +01:00
|
|
|
diff --git a/dmd/globals.d b/dmd/globals.d
|
2019-09-03 19:06:03 +02:00
|
|
|
index 8589b6cf2..5dae07256 100644
|
2018-12-17 08:01:31 +01:00
|
|
|
--- a/dmd/globals.d
|
|
|
|
+++ b/dmd/globals.d
|
2019-09-03 19:06:03 +02:00
|
|
|
@@ -139,6 +139,7 @@ struct Param
|
2018-12-17 08:01:31 +01:00
|
|
|
bool is64bit = (size_t.sizeof == 8); // generate 64 bit code; true by default for 64 bit dmd
|
|
|
|
bool isLP64; // generate code for LP64
|
|
|
|
bool isLinux; // generate code for linux
|
2019-09-03 19:06:03 +02:00
|
|
|
+ bool isAndroidX86_64; // generate code for Android x86_64
|
2018-12-17 08:01:31 +01:00
|
|
|
bool isOSX; // generate code for Mac OSX
|
|
|
|
bool isWindows; // generate code for Windows
|
|
|
|
bool isFreeBSD; // generate code for FreeBSD
|
|
|
|
diff --git a/dmd/globals.h b/dmd/globals.h
|
2019-09-03 19:06:03 +02:00
|
|
|
index 098116f4d..57429400c 100644
|
2018-12-17 08:01:31 +01:00
|
|
|
--- a/dmd/globals.h
|
|
|
|
+++ b/dmd/globals.h
|
2019-09-03 19:06:03 +02:00
|
|
|
@@ -119,6 +119,7 @@ struct Param
|
2018-12-17 08:01:31 +01:00
|
|
|
bool is64bit; // generate 64 bit code
|
|
|
|
bool isLP64; // generate code for LP64
|
|
|
|
bool isLinux; // generate code for linux
|
2019-09-03 19:06:03 +02:00
|
|
|
+ bool isAndroidX86_64; // generate code for Android x86_64
|
2018-12-17 08:01:31 +01:00
|
|
|
bool isOSX; // generate code for Mac OSX
|
|
|
|
bool isWindows; // generate code for Windows
|
|
|
|
bool isFreeBSD; // generate code for FreeBSD
|
|
|
|
diff --git a/driver/main.cpp b/driver/main.cpp
|
2019-09-03 19:06:03 +02:00
|
|
|
index c8c7ec2c5..18b581759 100644
|
2018-12-17 08:01:31 +01:00
|
|
|
--- a/driver/main.cpp
|
|
|
|
+++ b/driver/main.cpp
|
2019-09-03 19:06:03 +02:00
|
|
|
@@ -1000,6 +1000,9 @@ int cppmain() {
|
2018-12-17 08:01:31 +01:00
|
|
|
llvm::Triple *triple = new llvm::Triple(gTargetMachine->getTargetTriple());
|
|
|
|
global.params.targetTriple = triple;
|
|
|
|
global.params.isLinux = triple->isOSLinux();
|
2019-09-03 19:06:03 +02:00
|
|
|
+ global.params.isAndroidX86_64 =
|
|
|
|
+ triple->getEnvironment() == llvm::Triple::Android &&
|
|
|
|
+ triple->getArch() == llvm::Triple::x86_64;
|
2018-12-17 08:01:31 +01:00
|
|
|
global.params.isOSX = triple->isOSDarwin();
|
|
|
|
global.params.isWindows = triple->isOSWindows();
|
|
|
|
global.params.isFreeBSD = triple->isOSFreeBSD();
|