GNU bug report logs -
#13332
[PATCH] unbreak Emacs on Linux/M68K
Previous Next
Reported by: Mikael Pettersson <mikpe <at> it.uu.se>
Date: Wed, 2 Jan 2013 00:29:01 UTC
Severity: normal
Tags: patch
Fixed in version 24.3
Done: Andreas Schwab <schwab <at> linux-m68k.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13332 in the body.
You can then email your comments to 13332 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13332
; Package
emacs
.
(Wed, 02 Jan 2013 00:29:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mikael Pettersson <mikpe <at> it.uu.se>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 02 Jan 2013 00:29:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Attempting to bootstrap Emacs 23.x or 24.x on Linux/M68K fails with
a SEGV as soon as temacs is run. Inspecting the core dump shows:
Core was generated by `/home/mikpe/emacs-24.2/build-nox/src/temacs --batch --load loadu'.
Program terminated with signal 11, Segmentation fault.
#0 0x800d5444 in mark_object (arg=1174437910) at /home/mikpe/emacs-24.2/src/alloc.c:5720
5720 if (CONS_MARKED_P (ptr))
(gdb) bt
#0 0x800d5444 in mark_object (arg=1174437910) at /home/mikpe/emacs-24.2/src/alloc.c:5720
#1 0x800d55ba in mark_object (arg=-2143958762) at /home/mikpe/emacs-24.2/src/alloc.c:5731
#2 0x800d5c3a in mark_vectorlike (ptr=0x8035b120) at /home/mikpe/emacs-24.2/src/alloc.c:5420
#3 0x800d5d62 in Fgarbage_collect () at /home/mikpe/emacs-24.2/src/alloc.c:5128
#4 0x800eb7be in Ffuncall (nargs=3, args=0xefcdfad4) at /home/mikpe/emacs-24.2/src/eval.c:2938
#5 0x800ebc46 in call2 (fn=0, arg1=0, arg2=-2143972138) at /home/mikpe/emacs-24.2/src/eval.c:2785
#6 0x800ebf82 in Fsignal (error_symbol=0, data=-2143972138) at /home/mikpe/emacs-24.2/src/eval.c:1710
#7 0x800ec412 in xsignal (error_symbol=0, data=-2143972138) at /home/mikpe/emacs-24.2/src/eval.c:1785
#8 0x800ecdc8 in xsignal1 (error_symbol=0, arg=-2143955495) at /home/mikpe/emacs-24.2/src/eval.c:1800
#9 0x800ece32 in verror (m=0x8015f90d "Bad data in guts of obarray", ap=0xefce0b24) at /home/mikpe/emacs-24.2/src/eval.c:1998
#10 0x800ece44 in error (m=0x8015f90d "Bad data in guts of obarray") at /home/mikpe/emacs-24.2/src/eval.c:2010
#11 0x80108eec in oblookup (obarray=<optimized out>, ptr=0x80156383 "char-table-extra-slots", size=22, size_byte=22) at /home/mikpe/emacs-24.2/src/lread.c:3912
#12 0x8010c578 in intern_c_string (str=0x80156383 "char-table-extra-slots") at /home/mikpe/emacs-24.2/src/lread.c:3728
#13 0x8005ce76 in init_category_once () at /home/mikpe/emacs-24.2/src/category.c:461
#14 0x80006558 in main (argc=<optimized out>, argv=0xefce0ef4) at /home/mikpe/emacs-24.2/src/emacs.c:1265
(gdb) q
This turns out to be caused by the well-known issue of data alignment
on Linux/M68K: the ABI only aligns 32-bit (and larger) primitive types
to 16-bit boundaries, which doesn't provide enough known-zero bits in
object pointers for Emacs' tagging scheme, causing major confusion and
breakage at runtime.
This patch introduces two new integer types in src/m/m68k.h that are
exactly like int and unsigned int, except they are explicitly aligned
to 32-bit boundaries; gcc's attribute aligned is used for this purpose.
It then defines EMACS_INT and EMACS_UINT to these types to override the
default choices in src/lisp.h.
With this patch in place bootstrap succeeds and the final emacs
executable works fine. Tested with Emacs-24.2 on Linux/M68K.
/Mikael Pettersson
[I consider this 6-line patch (not counting the comment) to be trivial so
I hope it will be acceptable even without a formal copyright assignment.]
src/ChangeLog:
2013-01-01 Mikael Pettersson <mikpe <at> it.uu.se>
* m/m68k.h [GNU_LINUX] (m68k_aligned_int_t, m68k_aligned_uint_t):
New typedefs.
(EMACS_INT, EMACS_UINT, BITS_PER_EMACS_INT, pI): Define.
--- emacs-24.2/src/m/m68k.h.~1~ 2012-08-23 07:33:42.000000000 +0200
+++ emacs-24.2/src/m/m68k.h 2013-01-01 14:26:10.000000000 +0100
@@ -28,5 +28,19 @@ along with GNU Emacs. If not, see <http
#define DATA_SEG_BITS 0x80000000
#endif
+/* Define the type to use.
+ Emacs cannot use the default type (plain int) since the ABI on
+ Linux/M68K only aligns 32-bit (and larger) primitive types to
+ 16-bit boundaries. Define new explicitly aligned integer types
+ and use them for EMACS_INT and EMACS_UINT. Compiling Emacs
+ with -malign-int does not work since it changes data layout in
+ external interfaces (system calls, libraries). */
+typedef int m68k_aligned_int_t __attribute__ ((__aligned__ (4)));
+typedef unsigned int m68k_aligned_uint_t __attribute__ ((__aligned__ (4)));
+#define EMACS_INT m68k_aligned_int_t
+#define EMACS_UINT m68k_aligned_uint_t
+#define BITS_PER_EMACS_INT 32
+#define pI ""
+
#endif
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13332
; Package
emacs
.
(Wed, 02 Jan 2013 03:15:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 13332 <at> debbugs.gnu.org (full text, mbox):
This part of Emacs has changed in the trunk -- there's no longer
an m/m68k.h file. But more important, can you explain more why the
patch is needed, and how it works? First, Emacs shouldn't require
any particular alignment for EMACS_INT: the alignment requirements
are on the larger objects that Emacs allocates, not on EMACS_INT
per se. Second, even if there's a bug in Emacs where it's
incorrectly assuming that EMACS_INT is aligned, I would expect it
to require an alignment of 8, not of 4, since Emacs uses 3 tag
bits, not 2.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13332
; Package
emacs
.
(Wed, 02 Jan 2013 10:15:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 13332 <at> debbugs.gnu.org (full text, mbox):
The last time I tested emacs on m68k (about 8 months ago, before 24.2)
it worked fine after I've fixed an alignment bug, see commit d2220b5.
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13332
; Package
emacs
.
(Wed, 02 Jan 2013 16:13:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 13332 <at> debbugs.gnu.org (full text, mbox):
Both emacs-24 and trunk are working fine for me.
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Reply sent
to
Andreas Schwab <schwab <at> linux-m68k.org>
:
You have taken responsibility.
(Wed, 02 Jan 2013 16:35:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Mikael Pettersson <mikpe <at> it.uu.se>
:
bug acknowledged by developer.
(Wed, 02 Jan 2013 16:35:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 13332-done <at> debbugs.gnu.org (full text, mbox):
I just noticed that the commit didn't make it into 24.2. But it should
be easy enough to backport for any interested parties.
Andreas.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13332
; Package
emacs
.
(Wed, 02 Jan 2013 22:41:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 13332-done <at> debbugs.gnu.org (full text, mbox):
Andreas Schwab writes:
> I just noticed that the commit didn't make it into 24.2. But it should
> be easy enough to backport for any interested parties.
I spotted three alignment-related trunk commits around that time:
f17846357a5b00985131f1766dc705efa995191f
d2220b5dc1122f7ee597d26f5ce874a768be9b08
68be74b0a5c9cdac93f4f1d19760925dd3d264ed
I can confirm that applying all three to 24.2 unbreaks it on m68k.
Case closed.
/Mikael
bug Marked as fixed in versions 24.3.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 03 Jan 2013 19:46:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 01 Feb 2013 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 12 years and 143 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.