From: Thomas Huth <thuth@redhat.com>
To: David CARLIER <devnexen@gmail.com>,
qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [PATCH 1/1] util/getauxval: Porting to FreeBSD getauxval feature
Date: Tue, 26 May 2020 09:21:38 +0200 [thread overview]
Message-ID: <4e0f6d35-8aa0-b81d-0902-00b76f44b571@redhat.com> (raw)
In-Reply-To: <CA+XhMqyZ9yZjckTcYinCOYqb4ybE6z9vmgcJzue1WEGuZ0NTWA@mail.gmail.com>
On 24/05/2020 14.09, David CARLIER wrote:
> Hi here porting qemu_getauxval to FreeBSD. Thanks. Regards.
>
> From 5be5e56a59631b28ed7b738d251dda252ba9b03e Mon Sep 17 00:00:00 2001
> From: David Carlier <devnexen@gmail.com>
> Date: Sun, 24 May 2020 13:03:32 +0100
> Subject: [PATCH] util/getauxval: FreeBSD has a similar auxilary vector API
>
> Signed-off-by: David Carlier <devnexen@gmail.com>
> ---
> configure | 6 ++++++
> util/getauxval.c | 6 ++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/configure b/configure
> index 2fc05c4465..545fd2364f 100755
> --- a/configure
> +++ b/configure
> @@ -5824,7 +5824,13 @@ getauxval=no
> cat > $TMPC << EOF
> #include <sys/auxv.h>
> int main(void) {
> +#if defined(__linux__)
> return getauxval(AT_HWCAP) == 0;
> +#elif defined(__FreeBSD__)
> + unsigned long a = 0;
> + return elf_aux_info(AT_HWCAP, &a, sizeof(a)) == 0;
> +#endif
> + return 1;
> }
> EOF
> if compile_prog "" "" ; then
That configure check looks wrong. On other systems (i.e. non-Linux and
non-FreeBSD), this code snippet will now compile successfully and thus
the configure script sets getauxval=yes. I'd suggest you change it this
way instead:
int main(void) {
+#if defined(__FreeBSD__)
+ unsigned long a = 0;
+ return elf_aux_info(AT_HWCAP, &a, sizeof(a)) == 0;
+#else
return getauxval(AT_HWCAP) == 0;
+#endif
}
... so that it still fails to compile by default on other systems.
Thomas
next prev parent reply other threads:[~2020-05-26 7:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-24 12:09 [PATCH 1/1] util/getauxval: Porting to FreeBSD getauxval feature David CARLIER
2020-05-26 7:21 ` Thomas Huth [this message]
2020-05-26 7:37 ` David CARLIER
-- strict thread matches above, loose matches on Subject: below --
2020-06-11 21:10 David CARLIER
2020-06-12 7:13 ` Laurent Vivier
2020-06-12 8:46 ` David CARLIER
2020-06-12 9:15 ` Laurent Vivier
2020-06-12 9:45 ` Paolo Bonzini
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=4e0f6d35-8aa0-b81d-0902-00b76f44b571@redhat.com \
--to=thuth@redhat.com \
--cc=armbru@redhat.com \
--cc=devnexen@gmail.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).