Re: Trouble building 2.49.60 beta on Fedora - arm64
Bruno Haible <[email protected]>
| Newsgroups | gmane.lisp.clisp.devel |
|---|---|
| Message-ID | <2018302.F8ElyiHOuU@omega> |
Hi Jerry, > Also, the aarch64 build fails like this: > > ;; Compiling file /builddir/build/BUILD/clisp-2.49.60/modules/asdf/asdf.lisp ... > *** - handle_fault error2 ! address = 0x2e0800084480 not in > [0x2e0000000000,0x2e0000066778) ! > SIGSEGV cannot be cured. Fault address = 0x2e0800084480. > GC count: 14 > Space collected by GC: 12036056 > Run time: 0 457240 > Real time: 0 476000 > GC time: 0 38463 > Permanently allocated: 165368 bytes. > Currently in use: 4392320 bytes. > Free space: 299880 bytes. > make[1]: Leaving directory '/builddir/build/BUILD/clisp-2.49.60/build/asdf' > make: Leaving directory '/builddir/build/BUILD/clisp-2.49.60/build' > make[1]: *** [Makefile:22: asdf.fas] Segmentation fault (core dumped) > make[1]: *** Deleting file 'asdf.fas' > make: *** [Makefile:2334: asdf] Error 2 > > Do you have any idea what might cause that? For arm64 support, please use the attached patch. Bruno ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ clisp-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/clisp-devel
arm64.diff
(text/x-patch, 6.4 KB)
diff -r 88aed3aaed64 src/lispbibl.d
--- a/src/lispbibl.d Sun Aug 20 10:04:52 2017 +0200
+++ b/src/lispbibl.d Sun Aug 20 17:27:32 2017 +0200
@@ -394,6 +394,13 @@
#define UNIX_DARWIN /* MacOS X, a.k.a. Darwin */
#endif
+/* On Linux/arm64, MALLOC_ADDRESS_RANGE comes out as a value < 1*2^32, but
+ for larger malloc()s, the address can be around 0x20*2^32 or 0x7F*2^32. */
+#if defined(UNIX_LINUX) && defined(ARM64)
+ #undef MALLOC_ADDRESS_RANGE
+ #define MALLOC_ADDRESS_RANGE STACK_ADDRESS_RANGE
+#endif
+
/* Choose the character set: */
#if defined(UNIX) || defined(WIN32)
@@ -2895,6 +2902,25 @@
#define oint_data_len oint_addr_len
#define oint_data_mask oint_addr_mask
#endif
+ #if defined(ARM64)
+ /* UNIX_LINUX:
+ CODE_ADDRESS_RANGE 0x0000000000000000UL
+ MALLOC_ADDRESS_RANGE 0x000000000E000000UL (varies, < 2^32)
+ SHLIB_ADDRESS_RANGE 0x0000002000000000UL
+ STACK_ADDRESS_RANGE 0x0000007FF0000000UL
+ Virtual address limit (= 2^(MMAP_FIXED_ADDRESS_HIGHEST_BIT+1)-1)
+ 0x0000007FFFFFFFFFUL
+ Bits 63..48 = type code, Bits 47..0 = address */
+ #define oint_type_shift 48
+ #define oint_type_len 16
+ #define oint_type_mask 0xFFFF000000000000UL
+ #define oint_addr_shift 0
+ #define oint_addr_len 48
+ #define oint_addr_mask 0x0000FFFFFFFFFFFFUL
+ #define oint_data_shift oint_addr_shift
+ #define oint_data_len oint_addr_len
+ #define oint_data_mask oint_addr_mask
+ #endif
#endif
#elif defined(WIDE_SOFT)
/* separate one 32-bit word for typcode and address. */
@@ -3007,7 +3033,7 @@
%% #endif
/* Integer type for typebits: */
-/* Use a #if cascade because oint_type_len may expand to an parenthezised expression. */
+/* Use a #if cascade because oint_type_len may expand to an parenthesized expression. */
#if oint_type_len <= 8
typedef uint8 tint;
#elif oint_type_len <= 16
@@ -3026,8 +3052,11 @@
%% #endif
/* Integer type for addresses: */
-/* Use a #if cascade because oint_addr_len may expand to an parenthezised expression. */
-#if oint_addr_len <= 8
+/* Use a #if cascade because oint_addr_len may expand to an parenthesized expression. */
+#if defined(WIDE_HARD)
+typedef uint64 aint;
+typedef sint64 saint;
+#elif oint_addr_len <= 8
typedef uint8 aint;
typedef sint8 saint;
#elif oint_addr_len <= 16
@@ -3043,7 +3072,7 @@
typedef unsigned_int_with_n_bits(oint_addr_len) aint;
typedef signed_int_with_n_bits(oint_addr_len) saint;
#endif
-%% #if oint_addr_len > 32 && oint_addr_len <= 64
+%% #if defined(WIDE_HARD) || (oint_addr_len > 32 && oint_addr_len <= 64)
%% sprintf(buf,"uint64"); emit_typedef(buf,"aint");
%% #if notused
%% sprintf(buf,"sint64"); emit_typedef(buf,"saint");
@@ -3941,7 +3970,7 @@
#if defined(I80386) || defined(POWERPC) || defined(ARM) || defined(S390)
#define varobject_alignment 4
#endif
-#if defined(SPARC) || defined(HPPA) || defined(MIPS) || defined(M88000) || defined(DECALPHA) || defined(IA64) || defined(AMD64)
+#if defined(SPARC) || defined(HPPA) || defined(MIPS) || defined(M88000) || defined(DECALPHA) || defined(IA64) || defined(AMD64) || defined(ARM64)
#define varobject_alignment 8
#endif
#if (!defined(TYPECODES) || defined(GENERATIONAL_GC)) && (varobject_alignment < 4)
diff -r 88aed3aaed64 src/makemake.in
--- a/src/makemake.in Sun Aug 20 10:04:52 2017 +0200
+++ b/src/makemake.in Sun Aug 20 17:27:32 2017 +0200
@@ -1317,6 +1317,13 @@
;;
esac
fi
+ # On aarch64, gcc 4.8.4 with binutils 2.24 produces code that, when TYPECODES
+ # is used, leads to a link error when linking lisp.run:
+ # relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `symbol_tab_data' defined in .data section in spvwtabs.o
+ # The option -fPIC is a workaround.
+ if [ "$cpu" = aarch64 ] ; then
+ XCFLAGS=$XCFLAGS' -fPIC'
+ fi
if [ $TSYS = win32gcc ] ; then
XCFLAGS=$XCFLAGS' -D_WIN32'
fi
diff -r 88aed3aaed64 src/spvw.d
--- a/src/spvw.d Sun Aug 20 10:04:52 2017 +0200
+++ b/src/spvw.d Sun Aug 20 17:27:32 2017 +0200
@@ -3159,6 +3159,11 @@
mach_vm_allocate are in the range 2^33...2^47. */
mem.heaps[0].heap_limit = 0x000200000000UL;
mem.heaps[1].heap_limit = 0x400000000000UL;
+ #elif defined(UNIX_LINUX) && defined(ARM64)
+ /* On Linux/arm64, the available addresses are in the range 0..2^39,
+ and there is room from 0x003000000000 to 0x007000000000. */
+ mem.heaps[0].heap_limit = 0x003000000000UL;
+ mem.heaps[1].heap_limit = 0x007000000000UL;
#elif defined(UNIX_FREEBSD) && defined(AMD64)
mem.heaps[0].heap_limit = 0x001000000000UL;
mem.heaps[1].heap_limit = 0x700000000000UL;
@@ -3204,6 +3209,13 @@
mem.heaps[0].heap_hardlimit = 0x200000000000UL;
mem.heaps[1].heap_limit = 0x200000000000UL; /* room until at least 0x400000000000 */
mem.heaps[1].heap_hardlimit = 0x400000000000UL;
+ #elif defined(UNIX_LINUX) && defined(ARM64)
+ /* On Linux/arm64, the available addresses are in the range 0..2^39,
+ and there is room from 0x003000000000 to 0x007000000000. */
+ mem.heaps[0].heap_limit = 0x003000000000UL;
+ mem.heaps[0].heap_hardlimit = 0x005000000000UL;
+ mem.heaps[1].heap_limit = 0x005000000000UL;
+ mem.heaps[1].heap_hardlimit = 0x007000000000UL;
#elif defined(TYPECODES) && (oint_addr_len+addr_shift > pointer_bitsize)
#ifdef UNIX_DARWIN
/* 'vmmap' shows that there is room between the malloc area at 0x01...... or 0x02......
diff -r 88aed3aaed64 src/spvw_allocate.d
--- a/src/spvw_allocate.d Sun Aug 20 10:04:52 2017 +0200
+++ b/src/spvw_allocate.d Sun Aug 20 17:27:32 2017 +0200
@@ -135,11 +135,11 @@
#endif
/* determines, if an address lies in the interval [0..2^oint_addr_len-1] : */
-#if !defined(TYPECODES) || defined(WIDE_SOFT)
+#if defined(WIDE_SOFT) || (oint_addr_len == pointer_bitsize)
#define pointable_usable_test(a) true
#else
#define pointable_usable_test(a) \
- ((void*)pointable(type_pointer_object(0,a)) == (void*)(a))
+ (((uintP)(a) >> oint_addr_len) == 0)
#endif
/* fetches memory from the operating system */
@@ -163,6 +163,9 @@
/* we cannot do anything with this piece of memory, return it again: */
begin_system_call();
free(addr);
+ fprintf(stderr,GETTEXTL("Warning: "));
+ fprintf(stderr,GETTEXTL("Return value of malloc() = %lx is not compatible with type code distribution."),(aint)addr);
+ fputc('\n',stderr);
end_system_call();
return NULL;
}