[klibc] [PATCH 1/1] x32 support

H. Peter Anvin hpa at zytor.com
Wed Apr 20 23:15:28 PDT 2016


On 04/13/16 22:40, Denis Bychkov wrote:
> On Wed, Apr 13, 2016 at 7:24 PM, Thorsten Glaser <tg at mirbsd.de> wrote:
>> Denis Bychkov dixit:
>>
>>> This is a klibc port to x32 architecture. I tried to reuse as many
>>> existing files as possible, hence, a
>>> script making symlinks to x86-64 files. I was running this on Debian
>>> for about six months and hopefully,
>>> found any close to surface bugs. Of course, there are plenty left.
>>
>> Cool, thanks, I’ve never gotten around to do so, I’ve asked hpa
>> and he said he won’t do it himself but probably accept a patch.
>>
>> mksh is a good toolchain testing suite; please get mksh 52c-1
>> from testing and build it with your klibc installed, including
>> running the testsuite (just debian/rules build will do, as long
>> as klcc is in $PATH) and let me look at the build and test log.
>
> Oh, thanks, it definitely shows some problems. I am going to fix them
> and re-submit the patch.
> The signals syscalls don't work. And the question is not why they
> don't work in my port, but rather why they DO WORK in the original
> code. As an example of some craziness:
>   rt_sigsuspend syscall expects sizeof(sigset_t) as the second argument
> and returns -EINVAL if it is != sizeof(sigset_t). In glibc it's
> defined like this
>
> # define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
> typedef struct
>    {
>      unsigned long int __val[_SIGSET_NWORDS];
>    } __sigset_t;
>
> where long int is 64-bit, i.e. the whole struct if 128 byte long, 1
> bit per signal for all 1024 signals.
> In klibc it's apparently defined as size_t for 64-bit size_t, so it's
> only 8 byte long. And it works anyway!
> It did not work for x32 because of size_t difference. And I believe,
> there is a lot of stuff like this.
> So yeah, thanks, I'll go fix it and return when it's done.
>

Yes, it really should be __kernel_ulong_t I belive.  The sanest thing 
would have been if the bigendian architectures hadn't f***'d up so badly 
and made the bit operations word-size-dependent.

	-hpa



More information about the klibc mailing list