Add alignment patch for m68k.

This commit is contained in:
ph10 2018-02-27 17:19:51 +00:00
parent fb18c811ca
commit 9c82a2af0f
2 changed files with 20 additions and 0 deletions

View File

@ -32,6 +32,12 @@ read from files via the -f option.
7. Added --enable-jit=auto support to configure.ac.
8. Added some dummy variables to the heapframe structure in 16-bit and 32-bit
modes for the benefit of m68k, where pointers can be 16-bit aligned. The
dummies force 32-bit alignment and this ensures that the structure is a
multiple of PCRE2_SIZE, a requirement that is tested at compile time. In other
architectures, alignment requirements take care of this automatically.
Version 10.31 12-February-2018
------------------------------

View File

@ -793,12 +793,23 @@ typedef struct heapframe {
uint8_t return_id; /* Where to go on in internal "return" */
uint8_t op; /* Processing opcode */
/* At this point, the structure is 16-bit aligned. On most architectures
the alignment requirement for a pointer will ensure that the eptr field below
is 32-bit or 64-bit aligned. However, on m68k it is fine to have a pointer
that is 16-bit aligned. We must therefore ensure that the occu vector is an
odd multiple of 16 bits so as to get back into 32-bit alignment. This happens
naturally when PCRE2_UCHAR is 8 bits wide, but needs fudges in the other
cases. Without these, this structure is no longer a multiple of PCRE2_SIZE
and the check below fails. */
#if PCRE2_CODE_UNIT_WIDTH == 8
PCRE2_UCHAR occu[6]; /* Used for other case code units */
#elif PCRE2_CODE_UNIT_WIDTH == 16
PCRE2_UCHAR occu[2]; /* Used for other case code units */
uint8_t unused[2]; /* Ensure 32-bit alignment (see above) */
#else
PCRE2_UCHAR occu[1]; /* Used for other case code units */
uint8_t unused[2]; /* Ensure 32-bit alignment (see above) */
#endif
/* The rest have to be copied from the previous frame whenever a new frame
@ -818,6 +829,9 @@ typedef struct heapframe {
PCRE2_SIZE ovector[131072]; /* Must be last in the structure */
} heapframe;
/* This typedef is a check that the size of the heapframe structure is a
multiple of PCRE2_SIZE. See various comments above. */
typedef char check_heapframe_size[
((sizeof(heapframe) % sizeof(PCRE2_SIZE)) == 0)? (+1):(-1)];