[Qemu-devel] [PATCH 10/12] configure: disable unaligned access warning on x86 arch

Philippe Mathieu-Daudé posted 12 patches 7 years, 9 months ago
[Qemu-devel] [PATCH 10/12] configure: disable unaligned access warning on x86 arch
Posted by Philippe Mathieu-Daudé 7 years, 9 months ago
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 configure | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/configure b/configure
index 56f9716609..28cd073941 100755
--- a/configure
+++ b/configure
@@ -276,6 +276,7 @@ cc_i386=i386-pc-linux-gnu-gcc
 libs_qga=""
 debug_info="yes"
 stack_protector=""
+host_supports_unaligned_access="no"
 
 if test -e "$source_path/.git"
 then
@@ -692,6 +693,13 @@ if test -z "$ARCH"; then
   ARCH="$cpu"
 fi
 
+# ARCH specific
+case "$ARCH" in
+  i386|x86_64)
+    host_supports_unaligned_access="yes"
+  ;;
+esac
+
 # OS specific
 
 # host *BSD for user mode
@@ -4993,6 +5001,15 @@ if test "$fortify_source" != "no"; then
   fi
 fi
 
+#################################################
+# check if host supports unaligned access
+
+if test "$host_supports_unaligned_access" != "no"; then
+  if compile_prog "-Werror -Wno-address-of-packed-member" "" ; then
+    QEMU_CFLAGS="-Wno-address-of-packed-member $QEMU_CFLAGS"
+  fi
+fi
+
 ##########################################
 # check if struct fsxattr is available via linux/fs.h
 
-- 
2.15.1


Re: [Qemu-devel] [PATCH 10/12] configure: disable unaligned access warning on x86 arch
Posted by Peter Maydell 7 years, 9 months ago
On 8 January 2018 at 17:29, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  configure | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)

This doesn't seem like the right approach to me. We
want this sort of thing to be a warning/error on x86,
because that's the host that everybody actually uses
to develop with. If they only show up on non-x86
hosts then the result will be a lot more bounced
pull requests because of only-non-x86 warnings.

thanks
-- PMM

Re: [Qemu-devel] [PATCH 10/12] configure: disable unaligned access warning on x86 arch
Posted by Michael S. Tsirkin 7 years, 9 months ago
On Mon, Jan 08, 2018 at 05:32:54PM +0000, Peter Maydell wrote:
> On 8 January 2018 at 17:29, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > ---
> >  configure | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> 
> This doesn't seem like the right approach to me. We
> want this sort of thing to be a warning/error on x86,
> because that's the host that everybody actually uses
> to develop with. If they only show up on non-x86
> hosts then the result will be a lot more bounced
> pull requests because of only-non-x86 warnings.
> 
> thanks
> -- PMM

And we can't be sure the compiler won't be doing something tricky by
assuming alignment in the future.

-- 
MST

Re: [Qemu-devel] [PATCH 10/12] configure: disable unaligned access warning on x86 arch
Posted by Philippe Mathieu-Daudé 7 years, 9 months ago
On 01/08/2018 02:32 PM, Peter Maydell wrote:
> On 8 January 2018 at 17:29, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  configure | 17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
> 
> This doesn't seem like the right approach to me. We
> want this sort of thing to be a warning/error on x86,
> because that's the host that everybody actually uses
> to develop with. If they only show up on non-x86
> hosts then the result will be a lot more bounced
> pull requests because of only-non-x86 warnings.

Ok, good point.

Thanks,

Phil.