diff options
| author | Alexey Abramov <levenson@mmer.org> | 2025-08-31 09:17:29 +0200 |
|---|---|---|
| committer | Efraim Flashner <efraim@flashner.co.il> | 2025-09-08 19:49:37 +0300 |
| commit | ab2fed9abc74fc13df0d2c659b96915be403fd42 (patch) | |
| tree | e3eb3e64f72b51715dd44da67d7aaaedd1025663 /gnu/packages/patches/re2c-Use-maximum-alignment.patch | |
| parent | 92c63391ee25205be3b8525d5d1fe5b9f345f37f (diff) | |
gnu: re2c: Fix build on armhf-linux.
* gnu/packages/re2c.scm (re2c)[arguments]: When building for armhf-linux
add a phase to apply a patch.
* gnu/packages/patches/re2c-Use-maximum-alignment.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
Change-Id: I9f056de47dc993b9ad779969f1eec71436c21160
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Diffstat (limited to 'gnu/packages/patches/re2c-Use-maximum-alignment.patch')
| -rw-r--r-- | gnu/packages/patches/re2c-Use-maximum-alignment.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gnu/packages/patches/re2c-Use-maximum-alignment.patch b/gnu/packages/patches/re2c-Use-maximum-alignment.patch new file mode 100644 index 00000000000..6d5b95354fb --- /dev/null +++ b/gnu/packages/patches/re2c-Use-maximum-alignment.patch @@ -0,0 +1,48 @@ +https://github.com/skvadrik/re2c/pull/555 + +From 44125b74628d17f0a0a6cf9b51dd1f24169cd2d5 Mon Sep 17 00:00:00 2001 +From: Alexey Abramov <levenson@mmer.org> +Date: Fri, 22 Aug 2025 08:10:08 +0200 +Subject: [PATCH] Use maximum alignment to ensure compatibility across all + architectures. + +--- + src/util/allocator.h | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/src/util/allocator.h b/src/util/allocator.h +index e6c85585b..56daf056f 100644 +--- a/src/util/allocator.h ++++ b/src/util/allocator.h +@@ -3,6 +3,7 @@ + + #include <stdint.h> + #include <stdlib.h> ++#include <stddef.h> + #include <algorithm> + #include <vector> + +@@ -78,11 +79,16 @@ class slab_allocator_t { + }; + + // Use maximum alignment. ++// Use alignment based on pointer size: 32-bit platforms need stronger alignment ++// for 64-bit types (double, long long), while 64-bit platforms are already ++// sufficiently aligned with pointer-sized alignment. ++constexpr size_t ALLOCATOR_ALIGNMENT = (sizeof(void*) == 4) ? alignof(max_align_t) : sizeof(void*); ++ + // Use different types to prevent accidentally mixing allocators for data with different life spans. +-using AstAllocator = slab_allocator_t<AllocatorKind::AST, 16 * 4096, sizeof(void*)>; +-using IrAllocator = slab_allocator_t<AllocatorKind::IR, 16 * 4096, sizeof(void*)>; +-using DfaAllocator = slab_allocator_t<AllocatorKind::DFA, 16 * 4096, sizeof(void*)>; +-using OutAllocator = slab_allocator_t<AllocatorKind::OUT, 16 * 4096, sizeof(void*)>; ++using AstAllocator = slab_allocator_t<AllocatorKind::AST, 16 * 4096, ALLOCATOR_ALIGNMENT>; ++using IrAllocator = slab_allocator_t<AllocatorKind::IR, 16 * 4096, ALLOCATOR_ALIGNMENT>; ++using DfaAllocator = slab_allocator_t<AllocatorKind::DFA, 16 * 4096, ALLOCATOR_ALIGNMENT>; ++using OutAllocator = slab_allocator_t<AllocatorKind::OUT, 16 * 4096, ALLOCATOR_ALIGNMENT>; + + } // namespace re2c + +-- +2.50.1 + |
