diff --git a/include/mgba-util/common.h b/include/mgba-util/common.h index e268dbad5..c5fd76ac5 100644 --- a/include/mgba-util/common.h +++ b/include/mgba-util/common.h @@ -218,6 +218,7 @@ typedef intptr_t ssize_t; #define ATTRIBUTE_UNUSED #define ATTRIBUTE_FORMAT(X, Y, Z) #define ATTRIBUTE_NOINLINE +#define ATTRIBUTE_ALIGN // Adapted from https://stackoverflow.com/a/2390626 #define _CONSTRUCTOR(FN, PRE) \ static void FN(void); \ @@ -232,6 +233,7 @@ typedef intptr_t ssize_t; #define ATTRIBUTE_UNUSED __attribute__((unused)) #define ATTRIBUTE_FORMAT(X, Y, Z) __attribute__((format(X, Y, Z))) #define ATTRIBUTE_NOINLINE __attribute__((noinline)) +#define ATTRIBUTE_ALIGN(X) __attribute__((aligned(X))) #define CONSTRUCTOR(FN) static __attribute__((constructor)) void FN(void) #endif diff --git a/src/arm/isa-arm.c b/src/arm/isa-arm.c index ae8d61820..644208531 100644 --- a/src/arm/isa-arm.c +++ b/src/arm/isa-arm.c @@ -738,6 +738,6 @@ DEFINE_INSTRUCTION_ARM(MSRRI, DEFINE_INSTRUCTION_ARM(SWI, cpu->irqh.swi32(cpu, opcode & 0xFFFFFF)) -const ARMInstruction _armTable[0x1000] = { +ATTRIBUTE_ALIGN(4096) const ARMInstruction _armTable[0x1000] = { DECLARE_ARM_EMITTER_BLOCK(_ARMInstruction) }; diff --git a/src/arm/isa-thumb.c b/src/arm/isa-thumb.c index ede7ba368..0d7f66f2f 100644 --- a/src/arm/isa-thumb.c +++ b/src/arm/isa-thumb.c @@ -400,6 +400,6 @@ DEFINE_INSTRUCTION_THUMB(BX, DEFINE_INSTRUCTION_THUMB(SWI, cpu->irqh.swi16(cpu, opcode & 0xFF)) -const ThumbInstruction _thumbTable[0x400] = { +ATTRIBUTE_ALIGN(4096) const ThumbInstruction _thumbTable[0x400] = { DECLARE_THUMB_EMITTER_BLOCK(_ThumbInstruction) };