Skip to content

Commit c95a417

Browse files
committed
odroidc1: fix GCC 14 build via config.mk -fpermissive patch (not cflags hook)
The initial fix appended -Wno-error flags to uboot_cflags_array, but that has no effect on this 2011-era hardkernel u-boot (odroidc-v2011.03): its pre-Kbuild config.mk assigns CFLAGS with := and ignores the framework's injected KCFLAGS/env CFLAGS. The build kept failing on the same GCC-14 default-errors (implicit-function-declaration, int-conversion, incompatible-pointer-types, ... in board.c/gpio.c/bootm.c) - confirmed by the flags being absent from the actual per-file gcc command lines. Replace the hook with a source patch that adds -fpermissive to config.mk's CFLAGS. In GCC 14, -fpermissive downgrades exactly those C permerrors back to warnings; verified accepted by arm-linux-gnueabi-gcc 14 and confirmed to build. ARCH=armhf, so the int<->pointer conversions are same-width and benign. Signed-off-by: Igor Pecovnik <igor@armbian.com>
1 parent e624ccb commit c95a417

2 files changed

Lines changed: 38 additions & 16 deletions

File tree

config/boards/odroidc1.conf

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,7 @@ write_uboot_platform() {
2727
dd if=/dev/zero of=$2 seek=1024 count=32 bs=512 conv=fsync > /dev/null 2>&1
2828
}
2929

30-
# GCC 14 (trixie host) promotes -Wint-conversion, -Wimplicit-function-declaration,
31-
# -Wimplicit-int and -Wincompatible-pointer-types from warning to hard error. This
32-
# 2011-era hardkernel Amlogic u-boot (odroidc-v2011.03) trips on all of them
33-
# (board.c / gpio.c / bootm.c: get_dev_by_name, vpu_probe, amlogic_gpio_*, malloc,
34-
# pointer-from-integer, ...). It built on noble/GCC 13; downgrade back to warnings
35-
# so it builds on trixie. ARCH=armhf, so the int<->pointer conversions are
36-
# same-width and benign.
37-
function post_config_uboot_target__odroidc1_downgrade_gcc14_errors() {
38-
uboot_cflags_array+=(
39-
"-Wno-error=implicit-function-declaration"
40-
"-Wno-error=implicit-int"
41-
"-Wno-error=int-conversion"
42-
"-Wno-error=incompatible-pointer-types"
43-
)
44-
return 0
45-
}
30+
# NB: the GCC 14 build fix lives in the u-boot source patch
31+
# patch/u-boot/legacy/board_odroidc1/fix-gcc14-permissive.patch, not a
32+
# uboot_cflags_array hook: this 2011 u-boot's config.mk assigns CFLAGS with :=
33+
# and ignores the framework-injected KCFLAGS, so a hook has no effect here.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From: Armbian
2+
Subject: [PATCH] odroidc1: build config.mk with -fpermissive for GCC 14
3+
4+
This 2011-era hardkernel Amlogic u-boot (odroidc-v2011.03) uses the pre-Kbuild
5+
build system: config.mk assigns CFLAGS with `:=`, ignoring the environment /
6+
KCFLAGS the Armbian build framework injects. So a post_config_uboot_target hook
7+
appending -Wno-error flags to uboot_cflags_array has no effect here (unlike the
8+
newer odroidxu4 u-boot, which honours KCFLAGS).
9+
10+
GCC 14 makes implicit-function-declaration, implicit-int, int-conversion,
11+
incompatible-pointer-types and return-mismatch hard errors *by default* (no
12+
-Werror needed), and this codebase trips on all of them (board.c/gpio.c/bootm.c:
13+
get_dev_by_name, vpu_probe, amlogic_gpio_*, malloc, pointer-from-integer, ...).
14+
It built fine on GCC 13 / noble.
15+
16+
-fpermissive downgrades exactly those C permerrors back to warnings (GCC 14 C
17+
behaviour, verified accepted by arm-linux-gnueabi-gcc 14). Add it straight to
18+
config.mk's CFLAGS so it lands on every object. ARCH is armhf, so the
19+
int<->pointer conversions are same-width and benign.
20+
21+
--- a/config.mk
22+
+++ b/config.mk
23+
@@ -192,6 +192,11 @@
24+
25+
CFLAGS += $(call cc-option,-fno-stack-protector)
26+
27+
+# GCC 14 makes implicit-function-declaration, implicit-int, int-conversion,
28+
+# incompatible-pointer-types and return-mismatch hard errors by default; this
29+
+# 2011 u-boot predates that. -fpermissive downgrades them back to warnings.
30+
+CFLAGS += $(call cc-option,-fpermissive)
31+
+
32+
# $(CPPFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
33+
# option to the assembler.
34+
AFLAGS_DEBUG :=

0 commit comments

Comments
 (0)