From a2fd42f174e8ec61f3d40c930f813d6042dac2ce Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 26 Jan 2022 16:57:34 +0900 Subject: [PATCH] [qfcc] Align progs memory to 32 bytes in the test harness This ensures the engine can align everything to 32 bytes. --- tools/qfcc/test/test-harness.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/test/test-harness.c b/tools/qfcc/test/test-harness.c index bf51508b9..a0a4bfd0c 100644 --- a/tools/qfcc/test/test-harness.c +++ b/tools/qfcc/test/test-harness.c @@ -120,10 +120,14 @@ load_file (progs_t *pr, const char *name, off_t *_size) return sym; } +#define ALIGN 32 + static void * allocate_progs_mem (progs_t *pr, int size) { - return malloc (size); + intptr_t mem = (intptr_t) malloc (size + ALIGN); + mem = (mem + ALIGN - 1) & ~(ALIGN - 1); + return (void *) mem; } static void