pc-bios/s390-ccw.img build fix for 2.7
cover pc-bios/s390-ccw.img build fix for 2.7
This was done pretty quickly, so some review would be nice. If OK, I think this should go via Conny for 2.7.
Christian Borntraeger (1):
pc-bios/s390-ccw.img: Fix build
pc-bios/s390-ccw/Makefile | 6 ++++-- pc-bios/s390-ccw/virtio.c | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-)
Signature · 1 line
2.5.5
PATCH 1/1 pc-bios/s390-ccw.img: Fix build
Since
commit a9c87304b76d ("build-sys: fix building with make CFLAGS=.. argument")
pc-bios/s390-ccw.img build might fail with
--- snip ---
main.o: In function `virtio_setup':qemu/pc-bios/s390-ccw/main.c:117: undefined reference to `__stack_chk_fail' --- snip ---
Changing the CFLAGS to QEMU_CFLAGS does the trick.
We also need to fix a potential aliasing bug as we now compile with -O2 instead of -O0. This was the warning message:
--- snip --- /home/cborntra/REPOS/qemu/pc-bios/s390-ccw/virtio.c:64:5: error:
dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
return kvm_hypercall(KVM_S390_VIRTIO_CCW_NOTIFY, *(u32 *)&schid,
--- snip ---
--- pc-bios/s390-ccw/Makefile | 6 ++++-- pc-bios/s390-ccw/virtio.c | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-)
pc-bios/s390-ccw/Makefile +4 -2
@@ -10,8 +10,10 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) .PHONY : all clean build-all OBJECTS = start.o main.o bootmap.o sclp-ascii.o virtio.o virtio-scsi.o -CFLAGS += -fPIE -fno-stack-protector -ffreestanding -march=z900 -CFLAGS += -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) +QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS += -march=z900 -fPIE +QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector) LDFLAGS += -Wl,-pie -nostdlib build-all: s390-ccw.img
pc-bios/s390-ccw/virtio.c +6 -1
@@ -61,7 +61,12 @@ static long kvm_hypercall(unsigned long nr, unsigned long param1,static long virtio_notify (SubChannelId schid,int vq_idx,long cookie) { -return kvm_hypercall (KVM_S390_VIRTIO_CCW_NOTIFY , *(u32 *)&schid, +union { +SubChannelId schid; +u32 value; + } sch; + sch.schid = schid; +return kvm_hypercall (KVM_S390_VIRTIO_CCW_NOTIFY , sch.value, vq_idx, cookie); }
Signature · 1 line
2.5.5
Re: [Qemu-devel] [PATCH 1/1] pc-bios/s390-ccw.img: Fix build
Quoted 12 lines · On Mon, 15 Aug 2016 12:28:11 +0200 Christian Borntraeger…
Since
commita9c87304b76d("build-sys: fix building with make CFLAGS=.. argument")pc-bios/s390-ccw.img build might fail with
--- snip ---
main.o: In function `virtio_setup':qemu/pc-bios/s390-ccw/main.c:117: undefined reference to `__stack_chk_fail' --- snip ---Changing the CFLAGS to
QEMU_CFLAGSdoes the trick.
Quoted 7 lines
We also need to fix a potential aliasing bug as we now compile with -O2 instead of -O0. This was the warning message:
--- snip ---
/home/cborntra/REPOS/qemu/pc-bios/s390-ccw/virtio.c:64:5: error:
dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
Can we preserve no strict aliasing somehow? I don't really want to change the bios code at that point if not needed.
Quoted 14 lines
return kvm_hypercall(KVM_S390_VIRTIO_CCW_NOTIFY, *(u32 *)&schid,--- snip ---
Signed-off-by Christian Borntraeger <[email protected]>--- pc-bios/s390-ccw/Makefile | 6 ++++-- pc-bios/s390-ccw/virtio.c | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-)pc-bios/s390-ccw/Makefile +0
-0
pc-bios/s390-ccw/Makefile $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) · line 17
Quoted 10 lines
pc-bios/s390-ccw/Makefile +4
-2@@ -10,8 +10,10 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) .PHONY : all clean build-all OBJECTS = start.o main.o bootmap.o sclp-ascii.o virtio.o virtio-scsi.o -CFLAGS += -fPIE -fno-stack-protector -ffreestanding -march=z900 -CFLAGS += -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) +QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS += -march=z900 -fPIE +QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector) LDFLAGS += -Wl,-pie -nostdlib
Does not look unreasonable, but as I've lost myself in the makefile dependencies before, I'd like another review.
PATCH v2 1/1 pc-bios/s390-ccw.img: Fix build
Since
commit a9c87304b76d ("build-sys: fix building with make CFLAGS=.. argument")
pc-bios/s390-ccw.img build might fail with
--- snip ---
main.o: In function `virtio_setup':qemu/pc-bios/s390-ccw/main.c:117: undefined reference to `__stack_chk_fail' --- snip ---
Changing the CFLAGS to QEMU_CFLAGS does the trick. We also need to add -fno-strict-aliasing as this was filtered out.
---V1->V2: use fno-strict-aliasing instead of changing the code
pc-bios/s390-ccw/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
pc-bios/s390-ccw/Makefile +4 -2
@@ -10,8 +10,10 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) .PHONY : all clean build-all OBJECTS = start.o main.o bootmap.o sclp-ascii.o virtio.o virtio-scsi.o -CFLAGS += -fPIE -fno-stack-protector -ffreestanding -march=z900 -CFLAGS += -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) +QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS += -march=z900 -fPIE -fno-strict-aliasing +QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector) LDFLAGS += -Wl,-pie -nostdlib build-all: s390-ccw.img
Signature · 1 line
2.5.5
Cornelia Huck
AppliedRe: [Qemu-devel] [PATCH v2 1/1] pc-bios/s390-ccw.img: Fix build
Quoted 10 lines · On Mon, 15 Aug 2016 13:03:17 +0200 Christian Borntraeger…
Since
commita9c87304b76d("build-sys: fix building with make CFLAGS=.. argument")pc-bios/s390-ccw.img build might fail with
--- snip ---
main.o: In function `virtio_setup':qemu/pc-bios/s390-ccw/main.c:117: undefined reference to `__stack_chk_fail' --- snip ---
Quoted 8 lines
Changing the CFLAGS to
QEMU_CFLAGSdoes the trick. We also need to add -fno-strict-aliasing as this was filtered out.Signed-off-by Christian Borntraeger <[email protected]>---
V1->V2: use fno-strict-aliasing instead of changing the codepc-bios/s390-ccw/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Thanks, applied.
Re: [Qemu-devel] [PATCH v2 1/1] pc-bios/s390-ccw.img: Fix build
In reply to Christian BorntraegerQuoted 27 lines · Christian Borntraeger
Since
commita9c87304b76d("build-sys: fix building with make CFLAGS=.. argument")pc-bios/s390-ccw.img build might fail with
--- snip ---
main.o: In function `virtio_setup':qemu/pc-bios/s390-ccw/main.c:117: undefined reference to `__stack_chk_fail' --- snip ---Changing the CFLAGS to
QEMU_CFLAGSdoes the trick. We also need to add -fno-strict-aliasing as this was filtered out.Signed-off-by Christian Borntraeger <[email protected]>---
V1->V2: use fno-strict-aliasing instead of changing the codepc-bios/s390-ccw/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)pc-bios/s390-ccw/Makefile +0
-0@@ -10,8 +10,10 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) .PHONY : all clean build-all
pc-bios/s390-ccw/Makefile $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) · line 19
Quoted 10 lines
pc-bios/s390-ccw/Makefile +4
-2OBJECTS = start.o main.o bootmap.o sclp-ascii.o virtio.o virtio-scsi.o -CFLAGS += -fPIE -fno-stack-protector -ffreestanding -march=z900 -CFLAGS += -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) +QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS += -march=z900 -fPIE -fno-strict-aliasing +QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector) LDFLAGS += -Wl,-pie -nostdlib build-all: s390-ccw.img
Looks pretty much like pc-bios/optionrom/Makefile with respect to C compiler flags.
Re: [Qemu-devel] [PATCH v2 1/1] pc-bios/s390-ccw.img: Fix build
Quoted 36 lines · On Wed, 17 Aug 2016 12:57:47 +0200 Paolo Bonzini <[email protected]> wrote:
Quoted 35 lines · Christian Borntraeger
Since
commita9c87304b76d("build-sys: fix building with make CFLAGS=.. argument")pc-bios/s390-ccw.img build might fail with
--- snip ---
main.o: In function `virtio_setup':qemu/pc-bios/s390-ccw/main.c:117: undefined reference to `__stack_chk_fail' --- snip ---Changing the CFLAGS to
QEMU_CFLAGSdoes the trick. We also need to add -fno-strict-aliasing as this was filtered out.Signed-off-by Christian Borntraeger <[email protected]>---
V1->V2: use fno-strict-aliasing instead of changing the codepc-bios/s390-ccw/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)pc-bios/s390-ccw/Makefile +4
-2@@ -10,8 +10,10 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) .PHONY : all clean build-all OBJECTS = start.o main.o bootmap.o sclp-ascii.o virtio.o virtio-scsi.o -CFLAGS += -fPIE -fno-stack-protector -ffreestanding -march=z900 -CFLAGS += -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) +QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS += -march=z900 -fPIE -fno-strict-aliasing +QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector) LDFLAGS += -Wl,-pie -nostdlib
Quoted 7 lines
pc-bios/s390-ccw/Makefile $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) · line 19
Quoted 2 lines
pc-bios/s390-ccw/Makefile +0
-0build-all: s390-ccw.imgLooks pretty much like pc-bios/optionrom/Makefile with respect to C compiler flags.
Reviewed-by Paolo Bonzini <[email protected]>
Yes, that's also what I thought, so I already pushed it upstream :)
Still, thanks for the review!