Browse Source

ldc: Add x86 build

android-5
Joakim 6 years ago
committed by Fredrik Fornwall
parent
commit
0e23c993cc
  1. 2
      packages/ldc/build.sh
  2. 62
      packages/ldc/ldc-phobos-math.patch.beforehostbuild

2
packages/ldc/build.sh

@ -18,7 +18,7 @@ TERMUX_PKG_SHA256=(952ba57a957079345333d3f6aaaac766cc49750859357c419efc0c897850b
eeb83d3356d6ba3f5892f629de466df79c02bac5fd1f0e1ecdf01fe6171d42ac)
TERMUX_PKG_DEPENDS="clang"
TERMUX_PKG_HOSTBUILD=true
TERMUX_PKG_BLACKLISTED_ARCHES="i686,x86_64"
TERMUX_PKG_BLACKLISTED_ARCHES="x86_64"
TERMUX_PKG_FORCE_CMAKE=yes
#These CMake args are only used to configure a patched LLVM
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="

62
packages/ldc/ldc-phobos-math.patch.beforehostbuild

@ -0,0 +1,62 @@
diff --git a/std/math.d b/std/math.d
index f6767b00e..efc726720 100644
--- a/runtime/phobos/std/math.d
+++ b/runtime/phobos/std/math.d
@@ -140,7 +140,8 @@ version(LDC)
version(CRuntime_Microsoft) version = LDC_MSVCRT;
- version(LDC_MSVCRT) {}
+ version(LDC_MSVCRT) {}
+ else version(Android) {}
else
{
version(X86) version = INLINE_YL2X;
@@ -172,7 +173,8 @@ else version(D_InlineAsm_X86_64)
}
// define InlineAsm*_X87 versions if real is defined as 80-bit x87
-version(LDC_MSVCRT) {}
+version(LDC_MSVCRT) {}
+else version(Android) {}
else
{
version (D_InlineAsm_X86) version = InlineAsm_X86_X87;
@@ -7323,21 +7325,24 @@ Returns:
R copysign(R, X)(R to, X from) @trusted pure nothrow @nogc
if (isFloatingPoint!(R) && isFloatingPoint!(X))
{
- version(LDC)
- {
- pragma(inline, true);
- return llvm_copysign(to, cast(R) from);
- }
- else
+ version(Android)
{
- ubyte* pto = cast(ubyte *)&to;
- const ubyte* pfrom = cast(ubyte *)&from;
+ version(X86_Any)
+ {
+ ubyte* pto = cast(ubyte *)&to;
+ const ubyte* pfrom = cast(ubyte *)&from;
- alias T = floatTraits!(R);
- alias F = floatTraits!(X);
- pto[T.SIGNPOS_BYTE] &= 0x7F;
- pto[T.SIGNPOS_BYTE] |= pfrom[F.SIGNPOS_BYTE] & 0x80;
- return to;
+ alias T = floatTraits!(R);
+ alias F = floatTraits!(X);
+ pto[T.SIGNPOS_BYTE] &= 0x7F;
+ pto[T.SIGNPOS_BYTE] |= pfrom[F.SIGNPOS_BYTE] & 0x80;
+ return to;
+ }
+ else
+ {
+ pragma(inline, true);
+ return llvm_copysign(to, cast(R) from);
+ }
}
}
Loading…
Cancel
Save