From: Thomas Huth <thuth@redhat.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: Supporting clang on windows
Date: Mon, 25 Nov 2024 12:19:34 +0100 [thread overview]
Message-ID: <05108195-009e-4d06-bc79-065b1e3432ed@redhat.com> (raw)
In-Reply-To: <CABgObfYeNW2WYVkPVGmaPKXHLC6bfHm8fFO+wuoQzZiOB5DPyA@mail.gmail.com>
On 25/11/2024 10.39, Paolo Bonzini wrote:
> On Mon, Nov 25, 2024 at 10:34 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
>> IMHO we need to have confidence not only in the current state of the code,
>> but also that we're not going to accidentally regresss it in the future.
>> This is what the gcc_struct attribute gives us confidence in.
>
> Yes, as you say below the "solution" to that could be simply to avoid
> bitfields. They are problematic anyway for big-endian machines, see
> the commit that Thomas pointed out. Unfortunately it's a
> human-enforced solution, but then it is already human-enforced for
> endianness issues.
>
>> As an alternative is it practical for us to eliminate all bitfields
>> from our structs ?
>
> It is (at least for guest-visible structs), but it is a lot of work
> and I don't think it's reasonable for it to block clang enablement on
> Windows.
>
> Of course it is possible for future contributions. Pierrick, would you
> like to contribute a patch to docs/devel/style.rst as well?
FWIW, I now did some compiling in the background, one time with GCC +
"-mms-bitfields" + "#define QEMU_PACKED __attribute__((gcc_struct, packed))"
and a second time with the same setting, but with "gcc_struct" removed from
the #define. Then I ran "pahole" on all qemu-system-* binaries from both
builds and compared the corresponding outputs. Seems like we are currently
clean and that 642ba89672279fbdd14016a90da239c85e845d18 likely was the last
problematic structure that we had.
So fine for me if we allow compiling with Clang on Windows now, but we
should make sure to avoid that those problems are sneaking in again. So
Pierrick, please provide a patch to docs/devel/style.rst to say that we
disallow bitfields in packed structs in future contributions. Then I think
it's ok to remove the gcc_struct from QEMU_PACKED. (Just my 2 cents, of course)
Thomas
next prev parent reply other threads:[~2024-11-25 11:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-24 0:21 Supporting clang on windows Pierrick Bouvier
2024-11-24 12:10 ` Paolo Bonzini
2024-11-24 20:23 ` Pierrick Bouvier
2024-11-25 7:00 ` Paolo Bonzini
2024-11-25 9:34 ` Daniel P. Berrangé
2024-11-25 9:39 ` Paolo Bonzini
2024-11-25 10:42 ` Peter Maydell
2024-11-25 11:19 ` Thomas Huth [this message]
2024-11-25 16:48 ` Pierrick Bouvier
2024-11-25 17:05 ` Peter Maydell
2024-11-25 21:47 ` Pierrick Bouvier
2024-11-26 21:24 ` Pierrick Bouvier
2024-11-25 16:55 ` Pierrick Bouvier
2024-11-25 7:15 ` Thomas Huth
2024-11-24 12:28 ` Philippe Mathieu-Daudé
2024-11-24 20:24 ` Pierrick Bouvier
2024-11-25 6:31 ` Thomas Huth
2024-11-25 14:04 ` Richard Henderson
2024-11-25 16:19 ` Pierrick Bouvier
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=05108195-009e-4d06-bc79-065b1e3432ed@redhat.com \
--to=thuth@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.