diff options
author | John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> | 2020-06-19 16:40:38 +0200 |
---|---|---|
committer | Sawyer X <xsawyerx@cpan.org> | 2020-06-20 16:35:47 +0300 |
commit | a760468c9355bafaee57e94f13705c0ea925d9ca (patch) | |
tree | abdf3941a75b5e6c0b8a72d8cd3c81d477db3c7b | |
parent | 727c4789c608a2a774171adeeeb1e5065009d397 (diff) | |
download | perl-a760468c9355bafaee57e94f13705c0ea925d9ca.tar.gz |
op.h: Add additional padding to struct opslab to ensure proper alignment
On m68k, the natural alignment is 16 bits which causes the opslab_opslot
member of struct opslab to be aligned at a 16-bit offset. Other 32-bit
and 64-bit architectures have a natural alignment of at least 32 bits, so
the offset is always guaranteed to be at least 32-bit-aligned.
Fix this by adding additional padding bytes before the opslab_opslot
member, both for cases when PERL_DEBUG_READONLY_OPS defined and not
defined to ensure the offset of oplab_slots is always 32-bit-aligned.
On architectures which have a natural alignment of at least 32 bits,
the padding does not affect the alignment, offsets or struct size.
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | op.h | 3 |
2 files changed, 4 insertions, 0 deletions
@@ -651,6 +651,7 @@ John Macdonald <jmm@revenge.elegant.com> John Malmberg <wb8tyw@gmail.com> John Nolan <jpnolan@Op.Net> John P. Linderman <jpl.jpl@gmail.com> +John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> John Peacock <jpeacock@messagesystems.com> John Pfuntner <pfuntner@vnet.ibm.com> John Poltorak <jp@eyup.org> @@ -713,6 +713,9 @@ struct opslab { units) */ # ifdef PERL_DEBUG_READONLY_OPS bool opslab_readonly; + U8 opslab_padding; /* padding to ensure that opslab_slots is always */ +# else + U16 opslab_padding; /* located at an offset with 32-bit alignment */ # endif OPSLOT opslab_slots; /* slots begin here */ }; |