summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Menzel <pmenzel@molgen.mpg.de>2022-10-02 20:17:04 +0200
committerMartin L Roth <gaumless@gmail.com>2022-12-09 04:01:35 +0000
commit75f1500cb61f281766e4f6261a92cc0e3075afc8 (patch)
tree20192c2e3c9615b031f08f034adf61720ad5f374
parentdba310c5546c833cf4bbbfa0102ae3848ec370e2 (diff)
downloadcoreboot-75f1500cb61f281766e4f6261a92cc0e3075afc8.tar.gz
coreboot-75f1500cb61f281766e4f6261a92cc0e3075afc8.tar.bz2
coreboot-75f1500cb61f281766e4f6261a92cc0e3075afc8.zip
Makefile.inc: Decrease minimal pagesize from 4 kB to 1 kB
commit ac23f9da757e8e47a6bdcfd619c54e9b4c2b906c upstream. GCC 12 incorrectly warns about an array out of bounds issue: ``` $ make V=1 # emulation/qemu-i440fx […] CC ramstage/arch/x86/ebda.o x86_64-linux-gnu-gcc-12 -MMD -Isrc -Isrc/include -Isrc/commonlib/include -Isrc/commonlib/bsd/include -Ibuild -I3rdparty/vboot/firmware/include -include src/include/kconfig.h -include src/include/rules.h -include src/commonlib/bsd/include/commonlib/bsd/compiler.h -I3rdparty -D__BUILD_DIR__=\"build\" -Isrc/arch/x86/include -D__ARCH_x86_32__ -pipe -g -nostdinc -std=gnu11 -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wno-trigraphs -Wimplicit-fallthrough -Wshadow -Wdate-time -Wtype-limits -Wvla -Wdangling-else -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -fno-pie -Wno-packed-not-aligned -fconserve-stack -Wnull-dereference -Wreturn-type -Wlogical-op -Wduplicated-cond -Wno-unused-but-set-variable -Werror -Os -Wno-address-of-packed-member -m32 -Wl,-b,elf32-i386 -Wl,-melf_i386 -m32 -fuse-ld=bfd -fno-stack-protector -Wl,--build-id=none -fno-delete-null-pointer-checks -Wlogical-op -march=i686 -mno-mmx -MT build/ramstage/arch/x86/ebda.o -D__RAMSTAGE__ -c -o build/ramstage/arch/x86/ebda.o src/arch/x86/ebda.c In file included from src/arch/x86/ebda.c:6: In function 'write_ble8', inlined from 'write_le8' at src/commonlib/include/commonlib/endian.h:155:2, inlined from 'write_le16' at src/commonlib/include/commonlib/endian.h:178:2, inlined from 'setup_ebda' at src/arch/x86/ebda.c:35:2, inlined from 'setup_default_ebda' at src/arch/x86/ebda.c:48:2: src/commonlib/include/commonlib/endian.h:27:26: error: array subscript 0 is outside array bounds of 'void[0]' [-Werror=array-bounds] 27 | *(uint8_t *)dest = val; | ~~~~~~~~~~~~~~~~~^~~~~ […] ``` [In GCC 12 the new parameter `min-pagesize` is added and defaults 4 kB.][1] It treats INTEGER_CST addresses smaller than that as assumed results of pointer arithmetics from NULL while addresses equal or larger than that as expected user constant addresses. For GCC 13 we can represent results from pointer arithmetics on NULL using &MEM[(void*)0 + offset] instead of (void*)offset INTEGER_CSTs. [1]: https://web.archive.org/web/20220711061810/https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 TEST=No compile error with gcc (Debian 12.2.0-3) 12.2.0 Original-Change-Id: I6e36633f42cb4dc5af53212c10c919a86e451ee0 Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Original-Reviewed-on: https://review.coreboot.org/c/coreboot/+/62830 Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com> Change-Id: I90dc714f1959e94e9dc53cd383db19dc0dd9ac37 Reviewed-on: https://review.coreboot.org/c/coreboot/+/70463 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rwxr-xr-xutil/xcompile/xcompile2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile
index e35904fde1dc..ffb089ab7d54 100755
--- a/util/xcompile/xcompile
+++ b/util/xcompile/xcompile
@@ -192,6 +192,8 @@ detect_special_flags() {
testcc "$GCC" "$CFLAGS_GCC -Wno-address-of-packed-member $FLAGS_GCC" &&
CFLAGS_GCC="$CFLAGS_GCC -Wno-address-of-packed-member"
+ testcc "$GCC" "$CFLAGS_GCC --param=min-pagesize=1024 $FLAGS_GCC" &&
+ CFLAGS_GCC="$CFLAGS_GCC --param=min-pagesize=1024"
case "$architecture" in
x86)
;;