mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
* gnu/packages/patches/sbcl-fix-arm64-shared-lib.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/lisp.scm (sbcl)[source]: Use it. Change-Id: Icb49d76e0e68e02f7e7bb9ef49ce862dcce3969a
129 lines
3.7 KiB
Diff
129 lines
3.7 KiB
Diff
From b25c5a9f89922554e1221dab761e1eb583113953 Mon Sep 17 00:00:00 2001
|
|
From: Douglas Katzman <dougk@google.com>
|
|
Date: Thu, 4 Sep 2025 13:28:15 -0400
|
|
Subject: [PATCH 1/2] Change asm to avoid 'ld' error making libsbcl.so on linux
|
|
|
|
Fixes lp#2122059
|
|
---
|
|
src/runtime/arm64-assem.S | 6 ++++++
|
|
1 file changed, 6 insertions(+)
|
|
|
|
diff --git a/src/runtime/arm64-assem.S b/src/runtime/arm64-assem.S
|
|
index 95e0bfc89..b708f4ca0 100644
|
|
--- a/src/runtime/arm64-assem.S
|
|
+++ b/src/runtime/arm64-assem.S
|
|
@@ -235,9 +235,15 @@ no_args:
|
|
|
|
// load CARDTABLE-TN. reg_NAME macros aren't autogenerated for native asm code
|
|
// and it hardly seems worth #defining it to use in one assembly statement.
|
|
+#ifdef LISP_FEATURE_LINUX
|
|
+ adrp x28, :got:gc_card_mark
|
|
+ ldr x28, [x28, #:got_lo12:gc_card_mark]
|
|
+ ldr x28, [x28]
|
|
+#else
|
|
adrp x28, PAGE(gc_card_mark)
|
|
add x28, x28, PAGELOW(gc_card_mark)
|
|
ldr x28, [x28]
|
|
+#endif
|
|
|
|
// Load the closure-fun (or simple-fun-self), in case we're
|
|
// trying to call a closure.
|
|
--
|
|
2.51.0
|
|
|
|
From 076ae8dfc67d23bda158666847c5f1b627d90778 Mon Sep 17 00:00:00 2001
|
|
From: Stas Boukarev <stassats@gmail.com>
|
|
Date: Thu, 4 Sep 2025 20:39:24 +0300
|
|
Subject: [PATCH 2/2] Fix libsbcl.so on linux arm64
|
|
|
|
It got already fixed but this one has a macro.
|
|
---
|
|
src/runtime/GNUmakefile | 2 +-
|
|
src/runtime/arm64-assem.S | 43 ++++++++++++++++++++++-----------------
|
|
2 files changed, 25 insertions(+), 20 deletions(-)
|
|
|
|
diff --git a/src/runtime/GNUmakefile b/src/runtime/GNUmakefile
|
|
index cb34b5586..3a63d1c67 100644
|
|
--- a/src/runtime/GNUmakefile
|
|
+++ b/src/runtime/GNUmakefile
|
|
@@ -138,7 +138,7 @@ libsbcl.so: $(PIC_OBJS)
|
|
%.pic.o: %.c
|
|
$(CC) -fPIC -c $(CPPFLAGS) $(filter-out -fno-pie,$(CFLAGS)) $< -o $@
|
|
%.pic.o: %.S # (-fPIC doesn't affect hand-written assembly source)
|
|
- $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ -DLIBSBCL
|
|
|
|
SHRINKWRAP_DEPS = ../../output/sbcl.core ../../tools-for-build/elftool.lisp
|
|
shrinkwrap-sbcl.s shrinkwrap-sbcl-core.o: $(SHRINKWRAP_DEPS)
|
|
diff --git a/src/runtime/arm64-assem.S b/src/runtime/arm64-assem.S
|
|
index b708f4ca0..1794fc60e 100644
|
|
--- a/src/runtime/arm64-assem.S
|
|
+++ b/src/runtime/arm64-assem.S
|
|
@@ -13,24 +13,37 @@
|
|
|
|
#endif
|
|
|
|
-#ifdef LISP_FEATURE_DARWIN
|
|
-#define GNAME(var) _##var
|
|
-#define PAGE(var) _##var@PAGE
|
|
-#define PAGELOW(var) _##var@PAGEOFF
|
|
-#else
|
|
-#define GNAME(var) var
|
|
-#define PAGE(var) var
|
|
-#define PAGELOW(var) #:lo12:##var
|
|
-#endif
|
|
-
|
|
#ifdef LISP_FEATURE_DARWIN
|
|
#define TYPE(name)
|
|
#define SIZE(name)
|
|
+#define GNAME(var) _##var
|
|
+
|
|
+.macro LOAD_GNAME, dest, symbol
|
|
+ adrp \dest, _\symbol@PAGE
|
|
+ ldr \dest, [\dest, _\symbol@PAGEOFF]
|
|
+.endm
|
|
+
|
|
#else
|
|
+
|
|
#define TYPE(name) .type name,%function
|
|
#define SIZE(name) .size name,.-name
|
|
+#define GNAME(var) var
|
|
+
|
|
+#ifdef LIBSBCL
|
|
+.macro LOAD_GNAME, dest, symbol
|
|
+ adrp \dest, :got:\symbol
|
|
+ ldr \dest, [\dest, #:got_lo12:\symbol]
|
|
+ ldr \dest, [\dest]
|
|
+.endm
|
|
+#else
|
|
+.macro LOAD_GNAME, dest, symbol
|
|
+ adrp \dest, \symbol
|
|
+ ldr \dest, [\dest, #:lo12:\symbol]
|
|
+.endm
|
|
+#endif
|
|
#endif
|
|
|
|
+
|
|
#ifdef LISP_FEATURE_SB_THREAD
|
|
.macro ENTER_PA
|
|
str reg_wNULL,[reg_THREAD,THREAD_PSEUDO_ATOMIC_BITS_OFFSET]
|
|
@@ -235,15 +248,7 @@ no_args:
|
|
|
|
// load CARDTABLE-TN. reg_NAME macros aren't autogenerated for native asm code
|
|
// and it hardly seems worth #defining it to use in one assembly statement.
|
|
-#ifdef LISP_FEATURE_LINUX
|
|
- adrp x28, :got:gc_card_mark
|
|
- ldr x28, [x28, #:got_lo12:gc_card_mark]
|
|
- ldr x28, [x28]
|
|
-#else
|
|
- adrp x28, PAGE(gc_card_mark)
|
|
- add x28, x28, PAGELOW(gc_card_mark)
|
|
- ldr x28, [x28]
|
|
-#endif
|
|
+ LOAD_GNAME x28, gc_card_mark
|
|
|
|
// Load the closure-fun (or simple-fun-self), in case we're
|
|
// trying to call a closure.
|
|
--
|
|
2.51.0
|
|
|