On 18 July 2012 17:29, Stefan Weil <s...@weilnetz.de> wrote: > Am 18.07.2012 10:01, schrieb Peter Maydell: >> I think this struct should use QEMU_PACKED, which will >> ensure that it is packed to GCC rules rather than MS >> rules. >> >> We also seem to have let a pile of new uses of attribute((packed)) >> slip in in hw/mfi.h. Those are probably bugs too.
> They are bugs (for w32 / w64 hosts). I just sent a patch to fix them. > > Some more which I did not fix are in the TCG debugger interface. > Maybe those also need to be fixed for w32 / w64, but that needs > more tests and reading of the debugger interface documentation. > Maybe Richard Henderson knows whether they should use QEMU_PACKED, > too. So, I think none of these structs will get actually used on Windows, because they're ELF structure layouts which only get used on hosts with ELF support. However I think it would be nice to use QEMU_PACKED for consistency. We can clearly straightforwardly switch the DebugInfo struct in tcg/tcg.c to use QEMU_PACKED. The remaining cases are all the same, in tcg/*/tcg-target.c: typedef struct { uint32_t len __attribute__((aligned((sizeof(void *))))); uint32_t cie_offset; tcg_target_long func_start __attribute__((packed)); tcg_target_long func_len __attribute__((packed)); uint8_t def_cfa[4]; uint8_t reg_ofs[14]; } DebugFrameFDE; I think we can just remove the packed attributes from the struct member fields and apply QEMU_PACKED to the whole struct: I don't think this will change any of the alignment or packing in the not-windows case. (It's not clear to me why the alignment attribute is applied to the len field rather than to the whole struct, but we don't need to change that I guess.) -- PMM