diff mbox series

[v2,2/5] linux-user: Add separate aarch64_be uname

Message ID 20171219201613.7399-3-michael.weiser@gmx.de
State New
Headers show
Series Add aarch64_be-linux-user target | expand

Commit Message

Michael Weiser Dec. 19, 2017, 8:16 p.m. UTC
Make big-endian aarch64 systems identify as aarch64_be as expected by
big-endian userland and toolchains.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
---
 linux-user/aarch64/target_syscall.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Laurent Vivier Dec. 20, 2017, 3:20 p.m. UTC | #1
Le 19/12/2017 à 21:16, Michael Weiser a écrit :
> Make big-endian aarch64 systems identify as aarch64_be as expected by
> big-endian userland and toolchains.
> 
> Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
> ---
>  linux-user/aarch64/target_syscall.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/target_syscall.h
> index 1b62953eeb..604ab99b14 100644
> --- a/linux-user/aarch64/target_syscall.h
> +++ b/linux-user/aarch64/target_syscall.h
> @@ -8,7 +8,11 @@ struct target_pt_regs {
>      uint64_t        pstate;
>  };
>  
> +#if defined(TARGET_WORDS_BIGENDIAN)
> +#define UNAME_MACHINE "aarch64_be"
> +#else
>  #define UNAME_MACHINE "aarch64"
> +#endif
>  #define UNAME_MINIMUM_RELEASE "3.8.0"

For aarch64_be, I think the minimum release should be 4.9.0
(see kernel commit cfa88c79462d "arm64: Set UTS_MACHINE in the Makefile")

Thanks,
Laurent
Peter Maydell Dec. 20, 2017, 3:36 p.m. UTC | #2
On 20 December 2017 at 15:20, Laurent Vivier <laurent@vivier.eu> wrote:
> Le 19/12/2017 à 21:16, Michael Weiser a écrit :
>> Make big-endian aarch64 systems identify as aarch64_be as expected by
>> big-endian userland and toolchains.
>>
>> Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
>> ---
>>  linux-user/aarch64/target_syscall.h | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/target_syscall.h
>> index 1b62953eeb..604ab99b14 100644
>> --- a/linux-user/aarch64/target_syscall.h
>> +++ b/linux-user/aarch64/target_syscall.h
>> @@ -8,7 +8,11 @@ struct target_pt_regs {
>>      uint64_t        pstate;
>>  };
>>
>> +#if defined(TARGET_WORDS_BIGENDIAN)
>> +#define UNAME_MACHINE "aarch64_be"
>> +#else
>>  #define UNAME_MACHINE "aarch64"
>> +#endif
>>  #define UNAME_MINIMUM_RELEASE "3.8.0"
>
> For aarch64_be, I think the minimum release should be 4.9.0
> (see kernel commit cfa88c79462d "arm64: Set UTS_MACHINE in the Makefile")

Isn't the thing that defines what we set the minimum-release
to glibc, not the kernel? That is, the reason we lie to the
guest about the kernel version for some architectures is because
the glibc for those archs insists on a minimum kernel version
which the host may not have. Unless aarch64_be glibc insists
on kernel 4.9.0 there's no need to tell the guest that.

thanks
-- PMM
Laurent Vivier Dec. 20, 2017, 3:51 p.m. UTC | #3
Le 20/12/2017 à 16:36, Peter Maydell a écrit :
> On 20 December 2017 at 15:20, Laurent Vivier <laurent@vivier.eu> wrote:
>> Le 19/12/2017 à 21:16, Michael Weiser a écrit :
>>> Make big-endian aarch64 systems identify as aarch64_be as expected by
>>> big-endian userland and toolchains.
>>>
>>> Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
>>> ---
>>>  linux-user/aarch64/target_syscall.h | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/target_syscall.h
>>> index 1b62953eeb..604ab99b14 100644
>>> --- a/linux-user/aarch64/target_syscall.h
>>> +++ b/linux-user/aarch64/target_syscall.h
>>> @@ -8,7 +8,11 @@ struct target_pt_regs {
>>>      uint64_t        pstate;
>>>  };
>>>
>>> +#if defined(TARGET_WORDS_BIGENDIAN)
>>> +#define UNAME_MACHINE "aarch64_be"
>>> +#else
>>>  #define UNAME_MACHINE "aarch64"
>>> +#endif
>>>  #define UNAME_MINIMUM_RELEASE "3.8.0"
>>
>> For aarch64_be, I think the minimum release should be 4.9.0
>> (see kernel commit cfa88c79462d "arm64: Set UTS_MACHINE in the Makefile")
> 
> Isn't the thing that defines what we set the minimum-release
> to glibc, not the kernel? That is, the reason we lie to the
> guest about the kernel version for some architectures is because
> the glibc for those archs insists on a minimum kernel version
> which the host may not have. Unless aarch64_be glibc insists
> on kernel 4.9.0 there's no need to tell the guest that.

As you are the author of the original commit (4a24a75810 "linux-user:
Allow targets to specify a minimum uname release"), I guess you're
right. So ignore my comment...

Thanks,
Laurent
Michael Weiser Dec. 20, 2017, 4:01 p.m. UTC | #4
Hi Peter,

On Wed, Dec 20, 2017 at 03:36:29PM +0000, Peter Maydell wrote:

> >>  #define UNAME_MINIMUM_RELEASE "3.8.0"

> > For aarch64_be, I think the minimum release should be 4.9.0
> > (see kernel commit cfa88c79462d "arm64: Set UTS_MACHINE in the Makefile")

> Isn't the thing that defines what we set the minimum-release
> to glibc, not the kernel? That is, the reason we lie to the
> guest about the kernel version for some architectures is because
> the glibc for those archs insists on a minimum kernel version
> which the host may not have. Unless aarch64_be glibc insists
> on kernel 4.9.0 there's no need to tell the guest that.

I can confirm that cross-compiled glibc runs fine with the current
value. Also, a native compile of glibc inside an qemu-aarch64_be binfmt
chroot configured without problem and currently churns along compiling.

My Gentoo setup calls configure with --enable-kernel=3.2.0 and that says
about this:

checking installed Linux kernel header files... 3.2.0 or later
configure: WARNING: minimum kernel version reset to 3.7.0
checking for kernel header at least 3.7.0... ok

So it seems your memory is right.
diff mbox series

Patch

diff --git a/linux-user/aarch64/target_syscall.h b/linux-user/aarch64/target_syscall.h
index 1b62953eeb..604ab99b14 100644
--- a/linux-user/aarch64/target_syscall.h
+++ b/linux-user/aarch64/target_syscall.h
@@ -8,7 +8,11 @@  struct target_pt_regs {
     uint64_t        pstate;
 };
 
+#if defined(TARGET_WORDS_BIGENDIAN)
+#define UNAME_MACHINE "aarch64_be"
+#else
 #define UNAME_MACHINE "aarch64"
+#endif
 #define UNAME_MINIMUM_RELEASE "3.8.0"
 #define TARGET_CLONE_BACKWARDS
 #define TARGET_MINSIGSTKSZ       2048