On 12/18/20 12:47 AM, Claudio Fontana wrote: > On 12/17/20 11:49 PM, Peter Maydell wrote: >> On Thu, 17 Dec 2020 at 22:45, Claudio Fontana <cfont...@suse.de> wrote: >>> >>> On 12/17/20 9:15 PM, Peter Maydell wrote: >>>> On Thu, 17 Dec 2020 at 19:46, Claudio Fontana <cfont...@suse.de> wrote: >>>> Yeah, don't try to ifdef out struct fields in common-compiled code... >>> >>> or should I? Using >>> >>> #ifdef NEED_CPU_H >>> #ifdef CONFIG_SOFTMMU >>> >>> seems to do what I expect. Is it wrong? >> >> I think that gives you two versions of the struct: >> - one seen by compiled-once files and by compiled-per-target softmmu files >> - one seen by compiled-per-target user-only files >> >> Since the user-only target executables link both compiled-per-target >> and compiled-once files I think they end up with different C files >> thinking the same struct has a different layout/size which seems >> like it's going to cause problems. >> >> thanks >> -- PMM >> > > It doesn't with > > #ifdef NEED_CPU_H > #ifdef CONFIG_SOFTMMU > > just double checked the pointers from both files compiled per target and > "common"; also all tests are ok. > > It immediately breaks if I replace those two defines with #ifndef > CONFIG_USER_ONLY and recompile. > > I thought it was by design, but I guess this is just a "lucky" accident?
By lucky accident I mean that CONFIG_SOFTMMU is a check in the positive instead of the #if !defined(CONFIG_USER_ONLY), so it ends up working.. > > Ciao, > > Claudio >