1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

gnu: ldc: Fix int128 alignment.

* gnu/packages/patches/ldc-i686-int128-alignment.patch: New patches.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/dlang.scm (ldc-bootstrap)[patches]: Use it.

Change-Id: I21671c2a54634c284d8832f0627fe28494e1b0b8
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
This commit is contained in:
Yelninei
2026-03-25 08:41:18 +00:00
committed by Liliana Marie Prikler
parent 5a44919bfd
commit e1bf330763
3 changed files with 43 additions and 1 deletions

View File

@@ -1754,6 +1754,7 @@ dist_patch_DATA = \
%D%/packages/patches/kwin-unwrap-executable-name-for-dot-desktop-search.patch\
%D%/packages/patches/laby-make-install.patch \
%D%/packages/patches/laby-use-tmpdir-from-runtime.patch \
%D%/packages/patches/ldc-i686-int128-alignment.patch \
%D%/packages/patches/ldns-drill-examples.patch \
%D%/packages/patches/leela-zero-gtest.patch \
%D%/packages/patches/less-hurd-path-max.patch \

View File

@@ -75,7 +75,8 @@
(uri (string-append "https://github.com/ldc-developers/ldc/releases"
"/download/v" version "/ldc-" version "-src.tar.gz"))
(sha256
(base32 "13pkg69wjj4ali4ikijicccpg8y6f2hghhb70z9lrqr2w3pkhqna"))))
(base32 "13pkg69wjj4ali4ikijicccpg8y6f2hghhb70z9lrqr2w3pkhqna"))
(patches (search-patches "ldc-i686-int128-alignment.patch"))))
(build-system cmake-build-system)
(arguments
`(#:disallowed-references (,tzdata-for-tests)

View File

@@ -0,0 +1,40 @@
Description: Adjust int128 alignment
Author: Walter Bright <WalterBright@users.noreply.github.com>
Origin: backport, https://github.com/ldc-developers/ldc/commit/f634e2a6542a8b563d9ba1b680afd5337b4c09ea
Bug: https://github.com/ldc-developers/ldc/issues/1356
Last-Update: 2024-12-30
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/dmd/common/int128.d
+++ b/dmd/common/int128.d
@@ -20,7 +20,29 @@
alias U = ulong;
enum Ubits = uint(U.sizeof * 8);
-align(16) struct Cent
+version (DigitalMars)
+{
+ /* The alignment should follow target.stackAlign(),
+ * which is `isXmmSupported() ? 16 : (is64bit ? 8 : 4)
+ */
+ version (D_SIMD)
+ private enum Cent_alignment = 16;
+ else version (X86_64)
+ private enum Cent_alignment = 8;
+ else
+ private enum Cent_alignment = 4;
+}
+else
+{
+ version (LDC) version (X86) version = LDC_X86;
+
+ version (X86_64) private enum Cent_alignment = 16;
+ // 32-bit x86: need default alignment due to https://github.com/ldc-developers/ldc/issues/1356
+ else version (LDC_X86) private enum Cent_alignment = U.alignof;
+ else private enum Cent_alignment = (size_t.sizeof * 2);
+}
+
+align(Cent_alignment) struct Cent
{
U lo; // low 64 bits
U hi; // high 64 bits