Message ID | 1528966108-28324-1-git-send-email-thuth@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 06/14/2018 10:48 AM, Thomas Huth wrote: > Since we're storing the firmware blobs in the QEMU git repository, it > would be nice if the blobs would be a little bit smaller. By using -Os > and -fno-asynchronous-unwind-tables the size of the s390-ccw.img can be > decreased by ca. 4kB, and the size of s390-netboot.img even by ca. 45kB. > The change of speed of the firmware should not really matter compared to > a binary that has been compiled with -O2 since the firmware still starts > very fast. > > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > pc-bios/s390-ccw/Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile > index 439e3cc..f22a5ca 100644 > --- a/pc-bios/s390-ccw/Makefile > +++ b/pc-bios/s390-ccw/Makefile > @@ -13,6 +13,7 @@ OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ > virtio.o virtio-scsi.o virtio-blkdev.o libc.o > > QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) > +QEMU_CFLAGS += -Os -fno-asynchronous-unwind-tables Hmm, it looks like that the O2 comes after Os for me (which would override Os). cc -iquote /home/cborntra/REPOS/qemu/build/. -iquote . -iquote /home/cborntra/REPOS/qemu/tcg -iquote /home/cborntra/REPOS/qemu/tcg/s390 -I/home/cborntra/REPOS/qemu/linux-headers -I/home/cborntra/REPOS/qemu/build/linux-headers -iquote . -iquote /home/cborntra/REPOS/qemu -iquote /home/cborntra/REPOS/qemu/accel/tcg -iquote /home/cborntra/REPOS/qemu/include -Werror -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -Os -fno-asynchronous-unwind-tables -ffreestanding -fno-delete-null-pointer-checks -msoft-float -march=z900 -fPIE -fno-strict-aliasing -fno-stack-protector -MMD -MP -MT libc.o -MF ./libc.d -O2 -g -c -o libc.o /home/cborntra/REPOS/qemu/pc-bios/s390-ccw/libc.c so the effect is only because of the -fno-asynchronous-unwind-tables. > 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) >
On 14.06.2018 12:55, Christian Borntraeger wrote: > > On 06/14/2018 10:48 AM, Thomas Huth wrote: >> Since we're storing the firmware blobs in the QEMU git repository, it >> would be nice if the blobs would be a little bit smaller. By using -Os >> and -fno-asynchronous-unwind-tables the size of the s390-ccw.img can be >> decreased by ca. 4kB, and the size of s390-netboot.img even by ca. 45kB. >> The change of speed of the firmware should not really matter compared to >> a binary that has been compiled with -O2 since the firmware still starts >> very fast. > > >> >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> --- >> pc-bios/s390-ccw/Makefile | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile >> index 439e3cc..f22a5ca 100644 >> --- a/pc-bios/s390-ccw/Makefile >> +++ b/pc-bios/s390-ccw/Makefile >> @@ -13,6 +13,7 @@ OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ >> virtio.o virtio-scsi.o virtio-blkdev.o libc.o >> >> QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) >> +QEMU_CFLAGS += -Os -fno-asynchronous-unwind-tables > > Hmm, it looks like that the O2 comes after Os for me (which would override Os). > > cc -iquote /home/cborntra/REPOS/qemu/build/. -iquote . -iquote /home/cborntra/REPOS/qemu/tcg -iquote /home/cborntra/REPOS/qemu/tcg/s390 -I/home/cborntra/REPOS/qemu/linux-headers -I/home/cborntra/REPOS/qemu/build/linux-headers -iquote . -iquote /home/cborntra/REPOS/qemu -iquote /home/cborntra/REPOS/qemu/accel/tcg -iquote /home/cborntra/REPOS/qemu/include -Werror -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -Os -fno-asynchronous-unwind-tables -ffreestanding -fno-delete-null-pointer-checks -msoft-float -march=z900 -fPIE -fno-strict-aliasing -fno-stack-protector -MMD -MP -MT libc.o -MF ./libc.d -O2 -g -c -o libc.o /home/cborntra/REPOS/qemu/pc-bios/s390-ccw/libc.c > > so the effect is only because of the -fno-asynchronous-unwind-tables. Ugh, you're right - at least for the objects for s390-ccw.img. Seems like the -O2 comes from "CFLAGS" and not from "QEMU_CFLAGS" here, so the flags should be added to the CFLAGS variable instead. Actually, I was only looking at the object files from s390-netboot.img, and the libc files from SLOF get *only* compiled with QEMU_CFLAGS there (see LIBC_CFLAGS in netboot.mak). So the huge part of the s390-netboot.img binary got compiled without optimizations so far! That's why I was seeing such a big improvement there! Wow, I wonder why we did not notice this before... Anyway, I'll send a v2 to fix these issues. Thomas
diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile index 439e3cc..f22a5ca 100644 --- a/pc-bios/s390-ccw/Makefile +++ b/pc-bios/s390-ccw/Makefile @@ -13,6 +13,7 @@ OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ virtio.o virtio-scsi.o virtio-blkdev.o libc.o QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) +QEMU_CFLAGS += -Os -fno-asynchronous-unwind-tables 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)
Since we're storing the firmware blobs in the QEMU git repository, it would be nice if the blobs would be a little bit smaller. By using -Os and -fno-asynchronous-unwind-tables the size of the s390-ccw.img can be decreased by ca. 4kB, and the size of s390-netboot.img even by ca. 45kB. The change of speed of the firmware should not really matter compared to a binary that has been compiled with -O2 since the firmware still starts very fast. Signed-off-by: Thomas Huth <thuth@redhat.com> --- pc-bios/s390-ccw/Makefile | 1 + 1 file changed, 1 insertion(+)