[klibc] [PATCH 1/1] x32 support

Denis Bychkov manover at gmail.com
Wed Apr 13 22:40:04 PDT 2016


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.

>
> bye,
> //mirabilos
> --
> FWIW, I'm quite impressed with mksh interactively. I thought it was much
> *much* more bare bones. But it turns out it beats the living hell out of
> ksh93 in that respect. I'd even consider it for my daily use if I hadn't
> wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh



-- 

Denis



More information about the klibc mailing list