On Wed, 21 Jun 2023 at 11:00, Alex Bennée <alex.ben...@linaro.org> wrote: > > > Peter Maydell <peter.mayd...@linaro.org> writes: > > > On Wed, 21 Jun 2023 at 09:05, Alex Bennée <alex.ben...@linaro.org> wrote: > >> - I suspect the plugin core stuff could be build once (or maybe twice, > >> system and user) > > > > It is already build-once, that's why it goes wrong... > > I thought it was the other way around: > > specific_ss.add(when: 'CONFIG_PLUGIN', if_true: [files( > 'loader.c', > 'core.c', > 'api.c', > ), declare_dependency(link_args: plugin_ldflags)]) > > but if we built it for linux-user and softmmu this could be fixed (until > the next breakage anyway). cpus-common.c is the common code that sets > this once.
Oh, right, I got it the wrong way around. > >> - we need to have some guard rails somehow to make sure things don't > >> go out of sync > > > > We do, this is the poison.h stuff. CONFIG_USER_ONLY is a > > special case which we don't poison because there would be > > too much refactoring required... > > I guess a great big honking comment at the top of CPUState telling > people not to do that or pushing softmmu and user specific bits of > CPUState into their own de-referenced structures. It's not specific to CPUState, though. The thing you must not do is use CONFIG_USER_ONLY (or CONFIG_SOFTMMU, now) to ifdef out any struct field anywhere in any struct that's visible to compiled-once code, or otherwise do something that changes the ABI of a global or of a type passed around between functions. -- PMM