From: Alexandru Elisei <alexandru.elisei@arm.com>
To: "J. Neuschäfer" <j.neuschaefer@gmx.net>
Cc: kvm@vger.kernel.org, Alyssa Ross <hi@alyssa.is>,
will@kernel.org, julien.thierry.kdev@gmail.com
Subject: Re: [PATCH kvmtool v2 2/2] Get __WORDSIZE from <sys/reg.h> for musl compat
Date: Mon, 29 Jul 2024 17:24:24 +0100 [thread overview]
Message-ID: <ZqfCOOhF9dGf3G_c@raptor> (raw)
In-Reply-To: <20240727-musl-v2-2-b106252a1cba@gmx.net>
Hi,
CC'ing the maintainers (can be found in README).
On Sat, Jul 27, 2024 at 07:11:03PM +0200, J. Neuschäfer wrote:
> musl-libc doesn't provide <bits/wordsize.h>, but it defines __WORDSIZE
> in <sys/reg.h> and <sys/user.h>.
>
> Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
> ---
> include/linux/bitops.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/bitops.h b/include/linux/bitops.h
> index ae33922..4f133ba 100644
> --- a/include/linux/bitops.h
> +++ b/include/linux/bitops.h
> @@ -1,7 +1,7 @@
> #ifndef _KVM_LINUX_BITOPS_H_
> #define _KVM_LINUX_BITOPS_H_
>
> -#include <bits/wordsize.h>
> +#include <sys/reg.h>
When cross-compiling on x86 for arm64, as well as when compiling natively for
arm64 I get this error:
In file included from include/linux/bitmap.h:7,
from util/find.c:4:
include/linux/bitops.h:5:10: fatal error: sys/reg.h: No such file or directory
5 | #include <sys/reg.h>
| ^~~~~~~~~~~
compilation terminated.
make: *** [Makefile:510: util/find.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from include/linux/bitmap.h:7,
from util/bitmap.c:9:
include/linux/bitops.h:5:10: fatal error: sys/reg.h: No such file or directory
5 | #include <sys/reg.h>
| ^~~~~~~~~~~
compilation terminated.
make: *** [Makefile:510: util/bitmap.o] Error 1
Also, grep finds __WORDSIZE only in bits/wordsize.h on an x86 and arm64 machine:
$ grep -r "define __WORDSIZE" /usr/include/
/usr/include/bits/wordsize.h:# define __WORDSIZE 64
/usr/include/bits/wordsize.h:# define __WORDSIZE 32
/usr/include/bits/wordsize.h:# define __WORDSIZE32_SIZE_ULONG 1
/usr/include/bits/wordsize.h:# define __WORDSIZE32_PTRDIFF_LONG 1
/usr/include/bits/wordsize.h:#define __WORDSIZE_TIME64_COMPAT32 0
Thanks,
Alex
>
> #include <linux/kernel.h>
> #include <linux/compiler.h>
>
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2024-07-29 16:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-27 17:11 [PATCH kvmtool v2 0/2] Fix compilation with musl-libc based toolchains J. Neuschäfer
2024-07-27 17:11 ` [PATCH kvmtool v2 1/2] Switch to POSIX version of basename() J. Neuschäfer
2024-08-08 12:17 ` Andre Przywara
2024-07-27 17:11 ` [PATCH kvmtool v2 2/2] Get __WORDSIZE from <sys/reg.h> for musl compat J. Neuschäfer
2024-07-29 16:24 ` Alexandru Elisei [this message]
2024-07-30 15:02 ` Andre Przywara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZqfCOOhF9dGf3G_c@raptor \
--to=alexandru.elisei@arm.com \
--cc=hi@alyssa.is \
--cc=j.neuschaefer@gmx.net \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox