On Sun, 3 Aug 2025 at 21:11, Richard Henderson
<[email protected]> wrote:
>
> On 8/3/25 20:59, Peter Maydell wrote:
> > On Sun, 3 Aug 2025 at 00:20, Richard Henderson
> > <[email protected]> wrote:
> >>
> >> This typedef is synonymous with target_ulong.
> >>
> >> Signed-off-by: Richard Henderson <[email protected]>
> >> ---
> >>   linux-user/elfload.c | 29 +++++++++++++----------------
> >>   1 file changed, 13 insertions(+), 16 deletions(-)
> >>
> >> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> >> index fce4c05674..70a1e402d3 100644
> >> --- a/linux-user/elfload.c
> >> +++ b/linux-user/elfload.c
> >> @@ -131,10 +131,8 @@ int info_is_fdpic(struct image_info *info)
> >>   #endif
> >>
> >>   #ifdef TARGET_ABI_MIPSN32
> >> -typedef abi_ullong      target_elf_greg_t;
> >>   #define tswapreg(ptr)   tswap64(ptr)
> >>   #else
> >> -typedef abi_ulong       target_elf_greg_t;
> >>   #define tswapreg(ptr)   tswapal(ptr)
> >>   #endif
> >
> > Previously we had target_elf_greg_t:
> >   * for MIPSN32: abi_ullong, which is 64 bits
>
> MIPSN32 is a mips64 target.
>
> >   * for other TARGET_ABI32: abi_ulong, which is 32 bits
> >   * for 64-bit archs: abi_ulong, which is 64 bits
> >   * for 32-bit archs: abi_ulong, which is 32 bits
> >
> > Now we have target_ulong, which is:
> >   * for 64-bit archs: 64 bits
> >   * for 32-bit archs: 32 bits
> >
> > So the two TARGET_ABI32 which weren't special cased
> > (hppa and sparc32plus) will go from a 32-bit type to a 64-bit
> > type, won't they ?
> >
> > It wouldn't surprise me if this is a bug in the hppa and
> > sparc32plus cases, but if so we should say in the commit
> > message that we're fixing it.
>
> Neither sparc nor hppa implement core dumps so far,
> so we can put off considering them.

I guess so, but if we have to undo the refactoring because
it doesn't fit those architectures that would be annoying.

I had a look at the kernel sources and I think that here
mips N32 really is an outlier --
arch/mips/include/asm/elfcore-compat.h defines the
compat_elf_gregset_t to be the same as the (64-bit)
elf_gregset_t, and has some macro magic to handle the
O32 case which does have 32-bit registers.
On the other hand arch/parisc/include/asm/compat.h and
arch/sparc/include/asm/elf_64.h both define the
compat_elf_gregset_t type as 32-bit.

So I think it would be good to have at least a sketch of
how hppa and sparc32plus would work in the new setup and
why we wouldn't need to reintroduce the target_elf_greg_t
type, before we rip it out.

thanks
-- PMM

Reply via email to