aboutsummaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils.c b/utils.c
index 2fb8c2e..f2f45f6 100644
--- a/utils.c
+++ b/utils.c
@@ -304,6 +304,10 @@ WriteFieldDeclPrim(FILE *file, const argument_t *arg,
fprintf(file, "\t\tmach_msg_type_%st %s;\n",
arg->argLongForm ? "long_" : "", arg->argTTName);
+ if (!arg->argLongForm && complex_alignof > sizeof_mach_msg_type_t) {
+ /* Pad mach_msg_type_t in case we need alignment by more than its size. */
+ fprintf(file, "\t\tchar %s_pad[%d];\n", arg->argTTName, complex_alignof - sizeof_mach_msg_type_t);
+ }
if (it->itInLine && it->itVarArray)
{
@@ -338,7 +342,7 @@ void
WriteStructDecl(FILE *file, const argument_t *args, write_list_fn_t *func,
u_int mask, const char *name)
{
- fprintf(file, "#pragma pack(push,%d)\n", word_size);
+ fprintf(file, "#pragma pack(push,%d)\n", complex_alignof);
fprintf(file, "\ttypedef struct {\n");
fprintf(file, "\t\tmach_msg_header_t Head;\n");
WriteList(file, args, func, mask, "\n", "\n");