ldc: Update from 1.12 to 1.13 and add x64 build.
This commit is contained in:
parent
9555a93dd9
commit
3ccad90ac7
@ -1,24 +1,23 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://github.com/ldc-developers/ldc
|
||||
TERMUX_PKG_DESCRIPTION="D programming language compiler, built with LLVM"
|
||||
TERMUX_PKG_VERSION=()
|
||||
TERMUX_PKG_VERSION+=(1.12.0)
|
||||
TERMUX_PKG_VERSION+=(7.0.0) # LLVM version
|
||||
TERMUX_PKG_VERSION+=(2.082.1) # TOOLS version
|
||||
TERMUX_PKG_VERSION+=(1.11.0) # DUB version
|
||||
TERMUX_PKG_VERSION+=(1.13.0)
|
||||
TERMUX_PKG_VERSION+=(7.0.1) # LLVM version
|
||||
TERMUX_PKG_VERSION+=(2.083.1) # TOOLS version
|
||||
TERMUX_PKG_VERSION+=(1.12.1) # DUB version
|
||||
|
||||
TERMUX_PKG_SRCURL=(https://github.com/ldc-developers/ldc/releases/download/v${TERMUX_PKG_VERSION}/ldc-${TERMUX_PKG_VERSION}-src.tar.gz
|
||||
https://github.com/ldc-developers/llvm/releases/download/ldc-v${TERMUX_PKG_VERSION[1]}/llvm-${TERMUX_PKG_VERSION[1]}.src.tar.xz
|
||||
https://github.com/dlang/tools/archive/v${TERMUX_PKG_VERSION[2]}.tar.gz
|
||||
https://github.com/dlang/dub/archive/v${TERMUX_PKG_VERSION[3]}.tar.gz
|
||||
https://github.com/ldc-developers/ldc/releases/download/v${TERMUX_PKG_VERSION}/ldc2-${TERMUX_PKG_VERSION}-linux-x86_64.tar.xz)
|
||||
TERMUX_PKG_SHA256=(952ba57a957079345333d3f6aaaac766cc49750859357c419efc0c897850b5b9
|
||||
cc4f6fd2ec9002a9c7f4ff731c81be5b50672dd6d359e901ce58030f82f7b38a
|
||||
19c02fba1cb270cda3d7101448f36974e623e09a696ce2310a742faf2f3dfdad
|
||||
ef3f7d6ce0b726530973d9348a94fd91f9d02d30851ef3257ff538af4af571b6
|
||||
eeb83d3356d6ba3f5892f629de466df79c02bac5fd1f0e1ecdf01fe6171d42ac)
|
||||
TERMUX_PKG_SHA256=(4b2fd3eb90fb6debc0ae6d70406bc78fcb531a0f20806640e626d4822e87b2e0
|
||||
5b01afd896b534f4d6a0ff0073d9f1b09625b37b0a752259a1caf857c56c0fc3
|
||||
78d90dcda6b82d3eda69c30fa2308a8c8f1a3bce574d637806ca1af3c7f65888
|
||||
bd17cf67784f2ea0a2e0298761c662c80fddf6700c065f6689eb353e2144c987
|
||||
3692974b6dc6c81280c0321371b400101006f28bafb890f089b1d357dadbcbf1)
|
||||
TERMUX_PKG_DEPENDS="clang"
|
||||
TERMUX_PKG_HOSTBUILD=true
|
||||
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="
|
||||
@ -155,5 +154,5 @@ termux_step_make_install () {
|
||||
|
||||
rm -Rf $TERMUX_PREFIX/share/ldc
|
||||
mkdir $TERMUX_PREFIX/share/ldc
|
||||
cp -r $TERMUX_PKG_SRCDIR/{LICENSE,README,bash_completion.d} $TERMUX_PREFIX/share/ldc
|
||||
cp -r $TERMUX_PKG_SRCDIR/{LICENSE,README,packaging/bash_completion.d} $TERMUX_PREFIX/share/ldc
|
||||
}
|
||||
|
30
packages/ldc/ldc-druntime-link-symbols.patch
Normal file
30
packages/ldc/ldc-druntime-link-symbols.patch
Normal file
@ -0,0 +1,30 @@
|
||||
diff --git a/src/rt/sections_android.d b/src/rt/sections_android.d
|
||||
index cd8d5535..6a7fcd11 100644
|
||||
--- a/src/rt/sections_android.d
|
||||
+++ b/runtime/druntime/src/rt/sections_android.d
|
||||
@@ -76,7 +76,11 @@ void initSections() nothrow @nogc
|
||||
_sections.moduleGroup = ModuleGroup(mbeg[0 .. mend - mbeg]);
|
||||
|
||||
auto pbeg = cast(void*)&_tlsend;
|
||||
- auto pend = cast(void*)&__bss_end__;
|
||||
+ version(X86) auto pend = cast(void*)&_end;
|
||||
+ else version(X86_64) auto pend = cast(void*)& _end;
|
||||
+ else version(ARM) auto pend = cast(void*)& __bss_end__;
|
||||
+ else version(AArch64) auto pend = cast(void*)& __bss_end__;
|
||||
+ else static assert( false, "Android architecture not supported." );
|
||||
// _tlsend is a 32-bit int and may not be 64-bit void*-aligned, so align pbeg.
|
||||
version(D_LP64) pbeg = cast(void*)(cast(size_t)(pbeg + 7) & ~cast(size_t)7);
|
||||
_sections._gcRanges[0] = pbeg[0 .. pend - pbeg];
|
||||
@@ -209,7 +184,11 @@ extern(C)
|
||||
void* __stop_minfo;
|
||||
}
|
||||
|
||||
- size_t __bss_end__;
|
||||
+ version(X86) size_t _end;
|
||||
+ else version(X86_64) size_t _end;
|
||||
+ else version(ARM) size_t __bss_end__;
|
||||
+ else version(AArch64) size_t __bss_end__;
|
||||
+ else static assert( false, "Android architecture not supported." );
|
||||
|
||||
int _tlsstart;
|
||||
int _tlsend;
|
@ -1,80 +0,0 @@
|
||||
diff --git a/src/rt/sections_android.d b/src/rt/sections_android.d
|
||||
index cd8d5535..6a7fcd11 100644
|
||||
--- a/runtime/druntime/src/rt/sections_android.d
|
||||
+++ b/runtime/druntime/src/rt/sections_android.d
|
||||
@@ -76,7 +76,11 @@ void initSections() nothrow @nogc
|
||||
_sections.moduleGroup = ModuleGroup(mbeg[0 .. mend - mbeg]);
|
||||
|
||||
auto pbeg = cast(void*)&_tlsend;
|
||||
- auto pend = cast(void*)&__bss_end__;
|
||||
+ version(X86) auto pend = cast(void*)&_end;
|
||||
+ else version(X86_64) auto pend = cast(void*)& _end;
|
||||
+ else version(ARM) auto pend = cast(void*)& __bss_end__;
|
||||
+ else version(AArch64) auto pend = cast(void*)& __bss_end__;
|
||||
+ else static assert( false, "Android architecture not supported." );
|
||||
// _tlsend is a 32-bit int and may not be 64-bit void*-aligned, so align pbeg.
|
||||
version(D_LP64) pbeg = cast(void*)(cast(size_t)(pbeg + 7) & ~cast(size_t)7);
|
||||
_sections._gcRanges[0] = pbeg[0 .. pend - pbeg];
|
||||
@@ -115,43 +119,14 @@ void scanTLSRanges(void[]* rng, scope void delegate(void* pbeg, void* pend) noth
|
||||
* the corresponding address in the TLS dynamic per-thread data.
|
||||
*/
|
||||
|
||||
-version(X86)
|
||||
+extern(C) void* __tls_get_addr( void* p ) nothrow @nogc
|
||||
{
|
||||
- // NB: the compiler mangles this function as '___tls_get_addr'
|
||||
- // even though it is extern(D)
|
||||
- extern(D) void* ___tls_get_addr( void* p ) nothrow @nogc
|
||||
- {
|
||||
- debug(PRINTF) printf(" ___tls_get_addr input - %p\n", p);
|
||||
- immutable offset = cast(size_t)(p - cast(void*)&_tlsstart);
|
||||
- auto tls = getTLSBlockAlloc();
|
||||
- assert(offset < tls.length);
|
||||
- return tls.ptr + offset;
|
||||
- }
|
||||
-}
|
||||
-else version(ARM)
|
||||
-{
|
||||
- extern(C) void* __tls_get_addr( void** p ) nothrow @nogc
|
||||
- {
|
||||
- debug(PRINTF) printf(" __tls_get_addr input - %p\n", *p);
|
||||
- immutable offset = cast(size_t)(*p - cast(void*)&_tlsstart);
|
||||
- auto tls = getTLSBlockAlloc();
|
||||
- assert(offset < tls.length);
|
||||
- return tls.ptr + offset;
|
||||
- }
|
||||
-}
|
||||
-else version(AArch64)
|
||||
-{
|
||||
- extern(C) void* __tls_get_addr( void* p ) nothrow @nogc
|
||||
- {
|
||||
- debug(PRINTF) printf(" __tls_get_addr input - %p\n", p);
|
||||
- immutable offset = cast(size_t)(p - cast(void*)&_tlsstart);
|
||||
- auto tls = getTLSBlockAlloc();
|
||||
- assert(offset < tls.length);
|
||||
- return tls.ptr + offset;
|
||||
- }
|
||||
+ debug(PRINTF) printf(" __tls_get_addr input - %p\n", p);
|
||||
+ immutable offset = cast(size_t)(p - cast(void*)&_tlsstart);
|
||||
+ auto tls = getTLSBlockAlloc();
|
||||
+ assert(offset < tls.length);
|
||||
+ return tls.ptr + offset;
|
||||
}
|
||||
-else
|
||||
- static assert( false, "Android architecture not supported." );
|
||||
|
||||
private:
|
||||
|
||||
@@ -209,7 +184,11 @@ extern(C)
|
||||
void* __stop_minfo;
|
||||
}
|
||||
|
||||
- size_t __bss_end__;
|
||||
+ version(X86) size_t _end;
|
||||
+ else version(X86_64) size_t _end;
|
||||
+ else version(ARM) size_t __bss_end__;
|
||||
+ else version(AArch64) size_t __bss_end__;
|
||||
+ else static assert( false, "Android architecture not supported." );
|
||||
|
||||
int _tlsstart;
|
||||
int _tlsend;
|
@ -1,62 +0,0 @@
|
||||
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);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
55
packages/ldc/ldc-x64-sprintf.patch
Normal file
55
packages/ldc/ldc-x64-sprintf.patch
Normal file
@ -0,0 +1,55 @@
|
||||
diff --git a/dmd/globals.d b/dmd/globals.d
|
||||
index 464b8926..1d9befe1 100644
|
||||
--- a/dmd/globals.d
|
||||
+++ b/dmd/globals.d
|
||||
@@ -123,6 +123,7 @@ struct Param
|
||||
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
|
||||
+ bool isAndroid; // generate code for Android
|
||||
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
|
||||
index 24cd4912..df8a71bd 100644
|
||||
--- a/dmd/globals.h
|
||||
+++ b/dmd/globals.h
|
||||
@@ -100,6 +100,7 @@ struct Param
|
||||
bool is64bit; // generate 64 bit code
|
||||
bool isLP64; // generate code for LP64
|
||||
bool isLinux; // generate code for linux
|
||||
+ bool isAndroid; // generate code for Android
|
||||
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
|
||||
index 26c61e94..f9ec7f7b 100644
|
||||
--- a/driver/main.cpp
|
||||
+++ b/driver/main.cpp
|
||||
@@ -1023,6 +1023,7 @@ int cppmain(int argc, char **argv) {
|
||||
llvm::Triple *triple = new llvm::Triple(gTargetMachine->getTargetTriple());
|
||||
global.params.targetTriple = triple;
|
||||
global.params.isLinux = triple->isOSLinux();
|
||||
+ global.params.isAndroid = triple->getEnvironment() == llvm::Triple::Android;
|
||||
global.params.isOSX = triple->isOSDarwin();
|
||||
global.params.isWindows = triple->isOSWindows();
|
||||
global.params.isFreeBSD = triple->isOSFreeBSD();
|
||||
diff --git a/dmd/dmangle.d b/dmd/dmangle.d
|
||||
index 9fa8593b..ae29e307 100644
|
||||
--- a/dmd/dmangle.d
|
||||
+++ b/dmd/dmangle.d
|
||||
@@ -911,9 +911,13 @@ public:
|
||||
buf.writestring(value < CTFloat.zero ? "NINF" : "INF");
|
||||
else
|
||||
{
|
||||
+ version (IN_LLVM) import gen.llvmhelpers;
|
||||
enum BUFFER_LEN = 36;
|
||||
char[BUFFER_LEN] buffer;
|
||||
- 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.isAndroid && isArchx86_64() ? 'g' : 'A';
|
||||
+ const n = CTFloat.sprint(buffer.ptr, fmt, value);
|
||||
assert(n < BUFFER_LEN);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
Loading…
Reference in New Issue
Block a user