On 2/5/26 02:36, Pierrick Bouvier wrote:
On 2/3/26 5:36 PM, Richard Henderson wrote:
On 2/4/26 05:41, Pierrick Bouvier wrote:
target_arch() function will reparse target_name() every time if it was
not set to a proper SYS_EMU_TARGET_* value (when using
target-info-stub.c), which is not efficient.

Since we want to preserve the constness of TargetInfo but C doesn't give
us flexible compile time expressions, we simply set target_arch using a
static constructor once instead.

A static constructor isn't static initialization.
That said, we can do better with some extra help from meson; see attached.

I'm mildly annoyed with openrisc vs or1k.  We really ought to fix that, but I 
haven't
looked into what API breakage we get from selecting one or the other.


This was my first approach, and I noticed the or1k issue + missing hexagon in SYS_EMU_TARGET enum. Having a hack for target name in meson.build is *really* ugly IMHO.

I agree.

I assume the qapi string is the one that should take precedence; everything else appears to be merely qemu source level strings. Marcus, can you confirm?

At the moment, hexagon is only linux-user, so I thought it didn't make sense to add it to SYS_EMU_TARGET, and I didn't want to go down the rabbit hole to rename or extend this qapi definition, as the initial goal is just to define a field before main, which I consider to be static initialization, even though you might prefer to call it differently.

I was only going to ask you to change "statically" to "at startup" there.

On the other hand, system-mode patches for hexagon have been on the list for a while, so I don't think it's jumping the gun too much to include it in SYS_EMU_TARGET at this time.

I'll let you upstream whatever changes you prefer, and I drop this patch.

Ok, will do.


r~

Reply via email to