diff options
Diffstat (limited to 'src/trans/target.cpp')
-rw-r--r-- | src/trans/target.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/trans/target.cpp b/src/trans/target.cpp index d653a086..52a06909 100644 --- a/src/trans/target.cpp +++ b/src/trans/target.cpp @@ -194,6 +194,7 @@ namespace { StructRepr rv; size_t cur_ofs = 0; + size_t max_align = 1; for(auto& e : ents) { // Increase offset to fit alignment @@ -205,10 +206,19 @@ namespace { cur_ofs ++; } } + max_align = ::std::max(max_align, e.align); rv.ents.push_back(mv$(e)); cur_ofs += e.size; } + if( !packed ) + { + while( cur_ofs % max_align != 0 ) + { + rv.ents.push_back({ ~0u, 1, 1, ::HIR::TypeRef( ::HIR::CoreType::U8 ) }); + cur_ofs ++; + } + } return box$(rv); } } |