diff options
-rw-r--r-- | community/ldc/0001-Add-OpenBSD-to-section_ldc.d-202.patch | 24 | ||||
-rw-r--r-- | community/ldc/0002-LDC-Fix-TLS-range-with-static-druntime-on-Linux-x86-.patch | 105 | ||||
-rw-r--r-- | community/ldc/APKBUILD | 14 |
3 files changed, 4 insertions, 139 deletions
diff --git a/community/ldc/0001-Add-OpenBSD-to-section_ldc.d-202.patch b/community/ldc/0001-Add-OpenBSD-to-section_ldc.d-202.patch deleted file mode 100644 index 1f748807ead..00000000000 --- a/community/ldc/0001-Add-OpenBSD-to-section_ldc.d-202.patch +++ /dev/null @@ -1,24 +0,0 @@ -From e87efd1dd3360cb0e1079e8b8e6a438745e95028 Mon Sep 17 00:00:00 2001 -From: Brian Callahan <ibara@users.noreply.github.com> -Date: Sat, 23 Oct 2021 11:51:37 -0400 -Subject: [PATCH 1/2] Add OpenBSD to section_ldc.d (#202) - -This is needed to build on OpenBSD. ---- - src/rt/sections_ldc.d | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/rt/sections_ldc.d b/src/rt/sections_ldc.d -index 45a0e929..5ee022bc 100644 ---- a/runtime/druntime/src/rt/sections_ldc.d -+++ b/runtime/druntime/src/rt/sections_ldc.d -@@ -30,6 +30,7 @@ else version (Darwin) {} - else version (FreeBSD) {} - else version (DragonFlyBSD) {} - else version (NetBSD) {} -+else version (OpenBSD) {} - else version (Windows) {} - else version (LDC): - --- -2.30.1 (Apple Git-130) diff --git a/community/ldc/0002-LDC-Fix-TLS-range-with-static-druntime-on-Linux-x86-.patch b/community/ldc/0002-LDC-Fix-TLS-range-with-static-druntime-on-Linux-x86-.patch deleted file mode 100644 index a13a797edd7..00000000000 --- a/community/ldc/0002-LDC-Fix-TLS-range-with-static-druntime-on-Linux-x86-.patch +++ /dev/null @@ -1,105 +0,0 @@ -From ec3c0aafbf4b6f3345e276e21a26ffee077470cf Mon Sep 17 00:00:00 2001 -From: Martin Kinkelin <noone@nowhere.com> -Date: Sun, 24 Oct 2021 04:05:14 +0200 -Subject: [PATCH 2/2] LDC: Fix TLS range with static druntime on Linux x86/x64 - -After some manual tests with bfd and lld linkers, this should fix -https://github.com/ldc-developers/ldc/issues/3849. ---- - src/rt/sections_elf_shared.d | 51 ++++++++++++++++++++++++------------ - 1 file changed, 34 insertions(+), 17 deletions(-) - -diff --git a/src/rt/sections_elf_shared.d b/src/rt/sections_elf_shared.d -index 4bdb0091..4477b0de 100644 ---- a/runtime/druntime/src/rt/sections_elf_shared.d -+++ b/runtime/druntime/src/rt/sections_elf_shared.d -@@ -165,6 +165,8 @@ private: - { - size_t _tlsMod; - size_t _tlsSize; -+ version (LDC) -+ size_t _tlsAlignment; - } - else static if (SharedDarwin) - { -@@ -187,7 +189,10 @@ private: - { - static if (SharedELF) - { -- return getTLSRange(_tlsMod, _tlsSize); -+ version (LDC) -+ return getTLSRange(_tlsMod, _tlsSize, _tlsAlignment); -+ else -+ return getTLSRange(_tlsMod, _tlsSize); - } - else static if (SharedDarwin) - { -@@ -1029,12 +1034,7 @@ else - pdso._tlsMod = object.info.dlpi_tls_modid; - pdso._tlsSize = phdr.p_memsz; - version (LDC) -- { -- // align to multiple of size_t to avoid misaligned scanning -- // (size is subtracted from TCB address to get base of TLS) -- immutable mask = size_t.sizeof - 1; -- pdso._tlsSize = (pdso._tlsSize + mask) & ~mask; -- } -+ pdso._tlsAlignment = phdr.p_align; - break; - - default: -@@ -1207,25 +1207,42 @@ version (LDC) - version = Static_Linux_X86_Any; - } - --void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc -+// LDC: added `alignment` param -+void[] getTLSRange(size_t mod, size_t sz, size_t alignment) nothrow @nogc - { - version (Static_Linux_X86_Any) - { -+ void* tcb; - version (X86) -- static void* endOfBlock() nothrow @nogc { asm nothrow @nogc { naked; mov EAX, GS:[0]; ret; } } -+ asm nothrow @nogc { "mov %%gs:0, %0" : "=r" (tcb); } - else version (X86_64) -- static void* endOfBlock() nothrow @nogc { asm nothrow @nogc { naked; mov RAX, FS:[0]; ret; } } -+ asm nothrow @nogc { "mov %%fs:0, %0" : "=r" (tcb); } -+ -+ void* start = tcb - sz; -+ -+ // For non-ld.gold linkers, it seems to be necessary to align the -+ // pointer down according to the TLS alignment. -+ start = cast(void*) ((cast(size_t) start) & ~(alignment - 1)); - -- // FIXME: It is unclear whether aligning the area down to the next -- // double-word is necessary and if so, on what systems, but at least -- // some implementations seem to do it. -- version (none) -+ version (unittest) // verify against __tls_get_addr for static druntime unittest runners - { -- immutable mask = (2 * size_t.sizeof) - 1; -- sz = (sz + mask) & ~mask; -+ void* reference; -+ if (mod != 0) -+ { -+ auto ti = tls_index(mod, 0); -+ reference = __tls_get_addr(&ti); -+ } -+ -+ if (reference != start) -+ { -+ import core.stdc.stdlib : abort; -+ fprintf(stderr, "ERROR: getTLSRange mismatch - %p\n", start); -+ fprintf(stderr, " vs. %p\n", reference); -+ abort(); -+ } - } - -- return (endOfBlock() - sz)[0 .. sz]; -+ return start[0 .. sz]; - } - else - { --- -2.30.1 (Apple Git-130) diff --git a/community/ldc/APKBUILD b/community/ldc/APKBUILD index 670da3e8415..c421c2740fc 100644 --- a/community/ldc/APKBUILD +++ b/community/ldc/APKBUILD @@ -1,14 +1,12 @@ # Contributor: Mathias LANG <pro.mathias.lang@gmail.com> # Maintainer: Mathias LANG <pro.mathias.lang@gmail.com> pkgname=ldc -pkgver=1.28.0 -pkgrel=1 +pkgver=1.28.1 +pkgrel=0 pkgdesc="The LLVM-based D Compiler" url="https://github.com/ldc-developers/ldc" # LDC does not support host compiling on most of the architecture Alpine supports -# x86_64: ftbfs against GCC11 -#arch="x86_64 aarch64" -arch="aarch64" +arch="x86_64 aarch64" license="BSD-3-Clause AND BSL-1.0 AND ( Artistic-1.0 OR GPL-2.0-or-later ) AND NCSA AND MIT" depends="llvm-libunwind-dev tzdata $pkgname-static=$pkgver-r$pkgrel" makedepends="chrpath cmake curl-dev diffutils gdmd llvm12-dev llvm12-static @@ -22,8 +20,6 @@ subpackages=" $pkgname-static $pkgname-bash-completion:bashcomp:noarch" source="https://github.com/ldc-developers/ldc/releases/download/v$pkgver/ldc-$pkgver-src.tar.gz - 0001-Add-OpenBSD-to-section_ldc.d-202.patch - 0002-LDC-Fix-TLS-range-with-static-druntime-on-Linux-x86-.patch " builddir="$srcdir/ldc-$pkgver-src/" @@ -166,7 +162,5 @@ bashcomp() { } sha512sums=" -3e566282175d65eb075c9c076bcf0475658c747238ed91efd350a7834d6d54760310ac5249fb74db3812c07058efbca8d726427ef39055d77b3f9a6940bf4188 ldc-1.28.0-src.tar.gz -19a04c789b5f447dbc7dcf3536ef4f613ab4e637a4a707e3d5ba2445b4590881c030d7302a8ef3393ce5ca5bc9fb5695ba8b63b63fcd40b8d9c2fd147c079292 0001-Add-OpenBSD-to-section_ldc.d-202.patch -a59dc0c05f9e6c74efe8f6c9ea35dff89fd2a34fc79c793925df997904da3b6032803a74715641c11944f7ef49ab96ddea70eabc25005f2e00ad1d9af2bd7bd8 0002-LDC-Fix-TLS-range-with-static-druntime-on-Linux-x86-.patch +3ec4c754873db4c00fb2e45ec42a3641f46ed6a7d882c0a00edb9ee8a5686fad7c43e45068b7a216b2df89395860ccfc700a7f3efea38c2d3d0ac3b90dd5d3a1 ldc-1.28.1-src.tar.gz " |