Dear SeaBIOS folks,
Building SeaBIOS with GCC 8, the warnings below are shown.
``` $ gcc-8 --version gcc-8 (Debian 8-20180218-1) 8.0.1 20180218 (experimental) [trunk revision 257787] […] $ git log --oneline -1 5adc8bd (HEAD -> master, origin/master, origin/HEAD) tpm: Handle unimplemented TIS_REG_IFACE_ID in tis_get_tpm_version() $ make CC=gcc-8 scripts/kconfig/conf --olddefconfig /dev/shm/seabios2/src/Kconfig # # configuration written to /dev/shm/seabios2/.config # Build Kconfig config file Compile checking out/src/misc.o Compile checking out/src/stacks.o Compile checking out/src/output.o Compile checking out/src/string.o Compile checking out/src/block.o Compile checking out/src/cdrom.o Compile checking out/src/disk.o Compile checking out/src/mouse.o Compile checking out/src/kbd.o Compile checking out/src/system.o Compile checking out/src/serial.o Compile checking out/src/sercon.o Compile checking out/src/clock.o Compile checking out/src/resume.o Compile checking out/src/pnpbios.o Compile checking out/src/vgahooks.o Compile checking out/src/pcibios.o Compile checking out/src/apm.o Compile checking out/src/cp437.o Compile checking out/src/hw/pci.o Compile checking out/src/hw/timer.o Compile checking out/src/hw/rtc.o Compile checking out/src/hw/dma.o Compile checking out/src/hw/pic.o Compile checking out/src/hw/ps2port.o Compile checking out/src/hw/serialio.o Compile checking out/src/hw/usb.o Compile checking out/src/hw/usb-uhci.o Compile checking out/src/hw/usb-ohci.o Compile checking out/src/hw/usb-ehci.o Compile checking out/src/hw/usb-hid.o Compile checking out/src/hw/usb-msc.o Compile checking out/src/hw/usb-uas.o Compile checking out/src/hw/blockcmd.o Compile checking out/src/hw/floppy.o Compile checking out/src/hw/ata.o Compile checking out/src/hw/ramdisk.o Compile checking out/src/hw/lsi-scsi.o Compile checking out/src/hw/esp-scsi.o Compile checking out/src/hw/megasas.o Compile checking out/src/hw/mpt-scsi.o Compile checking out/src/post.o Compile checking out/src/e820map.o Compile checking out/src/malloc.o Compile checking out/src/romfile.o Compile checking out/src/x86.o Compile checking out/src/optionroms.o Compile checking out/src/pmm.o Compile checking out/src/font.o Compile checking out/src/boot.o Compile checking out/src/bootsplash.o Compile checking out/src/jpeg.o Compile checking out/src/bmp.o Compile checking out/src/tcgbios.o Compile checking out/src/sha1.o Compile checking out/src/hw/pcidevice.o Compile checking out/src/hw/ahci.o Compile checking out/src/hw/pvscsi.o Compile checking out/src/hw/usb-xhci.o Compile checking out/src/hw/usb-hub.o Compile checking out/src/hw/sdcard.o Compile checking out/src/fw/coreboot.o Compile checking out/src/fw/lzmadecode.o Compile checking out/src/fw/multiboot.o Compile checking out/src/fw/csm.o Compile checking out/src/fw/biostables.o Compile checking out/src/fw/paravirt.o Compile checking out/src/fw/shadow.o In file included from src/fw/shadow.c:17: src/fw/shadow.c: In function 'qemu_reboot': src/string.h:23:16: warning: '__builtin_memcpy' offset -1048576 is out of the bounds [0, 1] of object 'code32flat_start' with type 'char' [-Warray-bounds] #define memcpy __builtin_memcpy src/fw/shadow.c:190:9: note: in expansion of macro 'memcpy' memcpy(cstart, cstart + BIOS_SRC_OFFSET, hrp - cstart); ^~~~~~ In file included from src/biosvar.h:11, from src/fw/paravirt.h:5, from src/fw/shadow.c:16: src/fw/shadow.c:176:28: note: 'code32flat_start' declared here void *cstart = VSYMBOL(code32flat_start), *cend = VSYMBOL(code32flat_end); ^~~~~~~~~~~~~~~~ src/memmap.h:18:36: note: in definition of macro 'SYMBOL' #define SYMBOL(SYM) ({ extern char SYM; (u32)&SYM; }) ^~~ src/fw/shadow.c:176:20: note: in expansion of macro 'VSYMBOL' void *cstart = VSYMBOL(code32flat_start), *cend = VSYMBOL(code32flat_end); ^~~~~~~ In file included from src/fw/shadow.c:17: src/string.h:23:16: warning: '__builtin_memcpy' offset -1048572 is out of the bounds [0, 4] of object 'HaveRunPost' with type 'int' [-Warray-bounds] #define memcpy __builtin_memcpy src/fw/shadow.c:191:9: note: in expansion of macro 'memcpy' memcpy(hrp + 4, hrp + 4 + BIOS_SRC_OFFSET, cend - (hrp + 4)); ^~~~~~ In file included from src/fw/shadow.c:18: src/util.h:193:12: note: 'HaveRunPost' declared here extern int HaveRunPost; ^~~~~~~~~~~ Compile checking out/src/fw/pciinit.o Compile checking out/src/fw/smm.o Compile checking out/src/fw/smp.o Compile checking out/src/fw/mtrr.o Compile checking out/src/fw/xen.o Compile checking out/src/fw/acpi.o Compile checking out/src/fw/mptable.o Compile checking out/src/fw/pirtable.o Compile checking out/src/fw/smbios.o Compile checking out/src/fw/romfile_loader.o Compile checking out/src/hw/virtio-ring.o Compile checking out/src/hw/virtio-pci.o Compile checking out/src/hw/virtio-blk.o Compile checking out/src/hw/virtio-scsi.o Compile checking out/src/hw/tpm_drivers.o Compile checking out/src/hw/nvme.o Compiling whole program out/ccode32flat.o In file included from out/ccode32flat.o.tmp.c:4: In function 'qemu_reboot', inlined from 'tryReboot' at ./src/resume.c:129:5, inlined from 'handle_resume32' at ./src/resume.c:156:5: ./src/string.c:156:16: warning: '__builtin_memcpy' offset -1048576 is out of the bounds [0, 1] of object 'code32flat_start' with type 'char' [-Warray-bounds] #define memcpy __builtin_memcpy ./src/fw/shadow.c:190:9: note: in expansion of macro 'memcpy' memcpy(cstart, cstart + BIOS_SRC_OFFSET, hrp - cstart); ^~~~~~ In file included from ./src/biosvar.h:11, from ./src/misc.c:8, from out/ccode32flat.o.tmp.c:1: ./src/resume.c: In function 'handle_resume32': ./src/fw/shadow.c:176:28: note: 'code32flat_start' declared here void *cstart = VSYMBOL(code32flat_start), *cend = VSYMBOL(code32flat_end); ^~~~~~~~~~~~~~~~ ./src/memmap.h:18:36: note: in definition of macro 'SYMBOL' #define SYMBOL(SYM) ({ extern char SYM; (u32)&SYM; }) ^~~ ./src/fw/shadow.c:176:20: note: in expansion of macro 'VSYMBOL' void *cstart = VSYMBOL(code32flat_start), *cend = VSYMBOL(code32flat_end); ^~~~~~~ In file included from out/ccode32flat.o.tmp.c:4: In function 'qemu_reboot', inlined from 'tryReboot' at ./src/resume.c:129:5, inlined from 'handle_resume32' at ./src/resume.c:156:5: ./src/string.c:156:16: warning: '__builtin_memcpy' offset -1048572 is out of the bounds [0, 4] of object 'HaveRunPost' with type 'int' [-Warray-bounds] #define memcpy __builtin_memcpy ./src/fw/shadow.c:191:9: note: in expansion of macro 'memcpy' memcpy(hrp + 4, hrp + 4 + BIOS_SRC_OFFSET, cend - (hrp + 4)); ^~~~~~ In file included from ./src/stacks.c:17, from out/ccode32flat.o.tmp.c:2: ./src/resume.c: In function 'handle_resume32': ./src/util.h:193:12: note: 'HaveRunPost' declared here extern int HaveRunPost; ^~~~~~~~~~~ Compiling whole program out/code32seg.o Compiling whole program out/ccode16.o Compiling to assembler out/src/asm-offsets.s Generating offset file out/asm-offsets.h Compiling (16bit) out/romlayout.o Building ld scripts Version: rel-1.11.0-25-g5adc8bd Fixed space: 0xe05b-0x10000 total: 8101 slack: 12 Percent slack: 0.1% 16bit size: 37920 32bit segmented size: 2198 32bit flat size: 38890 32bit flat init size: 80416 Lowmem size: 2240 f-segment var size: 1248 Linking out/rom16.o Stripping out/rom16.strip.o Linking out/rom32seg.o Stripping out/rom32seg.strip.o Linking out/rom.o Prepping out/bios.bin.prep Total size: 168448 Fixed: 80256 Free: 93696 (used 64.3% of 256KiB rom) Creating out/bios.bin ```
Thanks,
Paul
On Thu, Mar 08, 2018 at 03:16:30PM +0100, Paul Menzel wrote:
Dear SeaBIOS folks,
Building SeaBIOS with GCC 8, the warnings below are shown.
[...]
In file included from src/fw/shadow.c:17: src/fw/shadow.c: In function 'qemu_reboot': src/string.h:23:16: warning: '__builtin_memcpy' offset -1048576 is out of the bounds [0, 1] of object 'code32flat_start' with type 'char' [-Warray-bounds] #define memcpy __builtin_memcpy src/fw/shadow.c:190:9: note: in expansion of macro 'memcpy' memcpy(cstart, cstart + BIOS_SRC_OFFSET, hrp - cstart); ^~~~~~
Well, technically the above code isn't valid C. It's always worked in practice though. The code needs to perform some memory copies based on physical addresses in memory - and we use the ELF symbol table to get at those memory addresses.
I'm surprsied that gcc still compains after the addresses have been cast to an integer. I'm not sure what format would make gcc happy.
-Kevin