mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-10 07:46:51 -04:00
Port pdumper to m68k
Problem reported by John Paul Adrian Glaubitz (bug#44531). * src/pdumper.c (DUMP_RELOCATION_ALIGNMENT_BITS): Remove. It’s not needed for optimization, as today’s compilers deduce that multiplying and dividing by the alignment can be done with shifts. All uses changed to use DUMP_RELOCATION_ALIGNMENT. (DUMP_RELOCATION_ALIGNMENT) [__mc68000__]: Now min (4, alignof (Lisp_Object)), not 4. (dump_reloc_set_offset): Change eassert to eassume to help the compiler.
This commit is contained in:
parent
0818bb3eb3
commit
407de5142c
3
etc/NEWS
3
etc/NEWS
|
|
@ -29,6 +29,9 @@ applies, and please also update docstrings as needed.
|
|||
The traditional unexec dumper, deprecated since Emacs 27, has been
|
||||
removed.
|
||||
|
||||
+++
|
||||
*** The portable dumper now works on m68k a.out targets.
|
||||
|
||||
---
|
||||
** Emacs's old 'ctags' program is no longer built or installed.
|
||||
You are encouraged to use Universal Ctags <https://ctags.io/> instead.
|
||||
|
|
|
|||
|
|
@ -268,10 +268,20 @@ struct dump_table_locator
|
|||
enum
|
||||
{
|
||||
DUMP_RELOC_TYPE_BITS = 5,
|
||||
DUMP_RELOC_ALIGNMENT_BITS = 2,
|
||||
|
||||
/* Minimum alignment required by dump file format. */
|
||||
DUMP_RELOCATION_ALIGNMENT = 1 << DUMP_RELOC_ALIGNMENT_BITS,
|
||||
/* Minimum alignment required by dump file format. Although this can
|
||||
be any integer power of 2 up to alignof (Lisp_Alignment),
|
||||
larger values help dump_reloc_set_offset support larger offsets.
|
||||
The fix for bug#44531 was discovered late during Emacs 31 development,
|
||||
so on Emacs 31 the value is 4 except on hosts where 4 is known to fail.
|
||||
The only known failure is m68k a.out, so work around the problem
|
||||
only if __mc68000__ is defined and the Lisp_Object alignment is 2,
|
||||
which is a known property of the m68k a.out format. */
|
||||
#ifdef __mc68000__
|
||||
DUMP_RELOCATION_ALIGNMENT = min (4, alignof (Lisp_Object)),
|
||||
#else
|
||||
DUMP_RELOCATION_ALIGNMENT = 4,
|
||||
#endif
|
||||
|
||||
/* The alignment granularity (in bytes) for objects we store in the
|
||||
dump. Always suitable for heap objects; may be more aligned. */
|
||||
|
|
@ -303,14 +313,14 @@ dump_reloc_set_type (struct dump_reloc *reloc, enum dump_reloc_type type)
|
|||
static dump_off
|
||||
dump_reloc_get_offset (struct dump_reloc reloc)
|
||||
{
|
||||
return reloc.raw_offset << DUMP_RELOC_ALIGNMENT_BITS;
|
||||
return reloc.raw_offset * DUMP_RELOCATION_ALIGNMENT;
|
||||
}
|
||||
|
||||
static void
|
||||
dump_reloc_set_offset (struct dump_reloc *reloc, dump_off offset)
|
||||
{
|
||||
eassert (offset >= 0);
|
||||
reloc->raw_offset = offset >> DUMP_RELOC_ALIGNMENT_BITS;
|
||||
eassume (offset >= 0);
|
||||
reloc->raw_offset = offset / DUMP_RELOCATION_ALIGNMENT;
|
||||
if (dump_reloc_get_offset (*reloc) != offset)
|
||||
error ("dump relocation out of range");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue