@@ -283,21 +283,26 @@ static void zend_gdbjit_symtab(zend_gdbjit_ctx *ctx)
283
283
sym -> info = ELFSYM_INFO (ELFSYM_BIND_GLOBAL , ELFSYM_TYPE_FUNC );
284
284
}
285
285
286
+ typedef ZEND_SET_ALIGNED (1 , uint16_t unaligned_uint16_t ) ;
287
+ typedef ZEND_SET_ALIGNED (1 , uint32_t unaligned_uint32_t ) ;
288
+ typedef ZEND_SET_ALIGNED (1 , uint16_t unaligned_uint16_t ) ;
289
+ typedef ZEND_SET_ALIGNED (1 , uintptr_t unaligned_uintptr_t ) ;
290
+
286
291
#define SECTALIGN (p , a ) \
287
292
((p) = (uint8_t *)(((uintptr_t)(p) + ((a)-1)) & ~(uintptr_t)((a)-1)))
288
293
289
294
/* Shortcuts to generate DWARF structures. */
290
295
#define DB (x ) (*p++ = (x))
291
296
#define DI8 (x ) (*(int8_t *)p = (x), p++)
292
- #define DU16 (x ) (*(uint16_t *)p = (x), p += 2)
293
- #define DU32 (x ) (*(uint32_t *)p = (x), p += 4)
294
- #define DADDR (x ) (*(uintptr_t *)p = (x), p += sizeof(uintptr_t))
297
+ #define DU16 (x ) (*(unaligned_uint16_t *)p = (x), p += 2)
298
+ #define DU32 (x ) (*(unaligned_uint32_t *)p = (x), p += 4)
299
+ #define DADDR (x ) (*(unaligned_uintptr_t *)p = (x), p += sizeof(uintptr_t))
295
300
#define DUV (x ) (ctx->p = p, zend_gdbjit_uleb128(ctx, (x)), p = ctx->p)
296
301
#define DSV (x ) (ctx->p = p, zend_gdbjit_sleb128(ctx, (x)), p = ctx->p)
297
302
#define DSTR (str ) (ctx->p = p, zend_gdbjit_strz(ctx, (str)), p = ctx->p)
298
303
#define DALIGNNOP (s ) while ((uintptr_t)p & ((s)-1)) *p++ = DW_CFA_nop
299
304
#define DSECT (name , stmt ) \
300
- { uint32_t *szp_##name = (uint32_t *)p; p += 4; stmt \
305
+ { unaligned_uint32_t *szp_##name = (uint32_t *)p; p += 4; stmt \
301
306
*szp_##name = (uint32_t)((p-(uint8_t *)szp_##name)-4); }
302
307
303
308
static void zend_gdbjit_ehframe (zend_gdbjit_ctx * ctx )
0 commit comments