| 1 |
From 5049f910aec254b9656dafe6c4cf7dd3d8b91d5c Mon Sep 17 00:00:00 2001 |
| 2 |
From: Quentin Schulz <[email protected]> |
| 3 |
Date: Thu, 31 Oct 2024 16:38:25 +0100 |
| 4 |
Subject: [PATCH 010/159] fix(rk3399): m0: Makefile: fix outside array bounds |
| 5 |
warning |
| 6 |
|
| 7 |
Both GCC and clang actually complain about: |
| 8 |
|
| 9 |
""" |
| 10 |
In file included from src/dram.c:12: |
| 11 |
src/dram.c: In function 'm0_main': |
| 12 |
include/rk3399_mcu.h:15:34: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=] |
| 13 |
15 | (*(volatile unsigned int *)(c)); __v; }) |
| 14 |
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 |
include/rk3399_mcu.h:16:69: note: in definition of macro 'mmio_write_32' |
| 16 |
16 | #define mmio_write_32(c, v) ((*(volatile unsigned int *)(c)) = (v)) |
| 17 |
| ^ |
| 18 |
src/dram.c:67:23: note: in expansion of macro 'mmio_read_32' |
| 19 |
67 | mmio_read_32(PARAM_ADDR + PARAM_FREQ_SELECT)); |
| 20 |
| ^~~~~~~~~~~~ |
| 21 |
cc1: note: source object is likely at address zero |
| 22 |
In function 'ddr_set_pll', |
| 23 |
inlined from 'm0_main' at src/dram.c:71:2: |
| 24 |
include/rk3399_mcu.h:14:40: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=] |
| 25 |
14 | #define mmio_read_32(c) ({unsigned int __v = \ |
| 26 |
| ^~~ |
| 27 |
include/rk3399_mcu.h:16:69: note: in definition of macro 'mmio_write_32' |
| 28 |
16 | #define mmio_write_32(c, v) ((*(volatile unsigned int *)(c)) = (v)) |
| 29 |
| ^ |
| 30 |
src/dram.c:47:23: note: in expansion of macro 'mmio_read_32' |
| 31 |
47 | mmio_read_32(PARAM_ADDR + PARAM_DPLL_CON0)); |
| 32 |
| ^~~~~~~~~~~~ |
| 33 |
In function 'm0_main': |
| 34 |
cc1: note: source object is likely at address zero |
| 35 |
In function 'ddr_set_pll', |
| 36 |
inlined from 'm0_main' at src/dram.c:71:2: |
| 37 |
include/rk3399_mcu.h:14:40: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=] |
| 38 |
14 | #define mmio_read_32(c) ({unsigned int __v = \ |
| 39 |
| ^~~ |
| 40 |
include/rk3399_mcu.h:16:69: note: in definition of macro 'mmio_write_32' |
| 41 |
16 | #define mmio_write_32(c, v) ((*(volatile unsigned int *)(c)) = (v)) |
| 42 |
| ^ |
| 43 |
src/dram.c:49:23: note: in expansion of macro 'mmio_read_32' |
| 44 |
49 | mmio_read_32(PARAM_ADDR + PARAM_DPLL_CON1)); |
| 45 |
| ^~~~~~~~~~~~ |
| 46 |
In function 'm0_main': |
| 47 |
cc1: note: source object is likely at address zero |
| 48 |
include/rk3399_mcu.h:16:35: warning: array subscript 0 is outside array bounds of 'volatile unsigned int[0]' [-Warray-bounds=] |
| 49 |
16 | #define mmio_write_32(c, v) ((*(volatile unsigned int *)(c)) = (v)) |
| 50 |
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 51 |
src/dram.c:80:9: note: in expansion of macro 'mmio_write_32' |
| 52 |
80 | mmio_write_32(PARAM_ADDR + PARAM_M0_DONE, M0_DONE_FLAG); |
| 53 |
| ^~~~~~~~~~~~~ |
| 54 |
cc1: note: source object is likely at address zero |
| 55 |
""" |
| 56 |
|
| 57 |
The global Makefile defines --param=min-pagesize=0 already, so let's |
| 58 |
just apply the same fix for the m0 part of the RK3399 binary. |
| 59 |
|
| 60 |
Suggested-by: Boyan Karatotev <[email protected]> |
| 61 |
Signed-off-by: Quentin Schulz <[email protected]> |
| 62 |
Change-Id: I4f29a579b9e4b01aa2540746ef46e2a382f0012e |
| 63 |
--- |
| 64 |
plat/rockchip/rk3399/drivers/m0/Makefile | 3 +++ |
| 65 |
1 file changed, 3 insertions(+) |
| 66 |
|
| 67 |
Index: arm-trusted-firmware/plat/rockchip/rk3399/drivers/m0/Makefile |
| 68 |
=================================================================== |
| 69 |
--- arm-trusted-firmware.orig/plat/rockchip/rk3399/drivers/m0/Makefile |
| 70 |
+++ arm-trusted-firmware/plat/rockchip/rk3399/drivers/m0/Makefile |
| 71 |
@@ -5,6 +5,7 @@ |
| 72 |
# |
| 73 |
|
| 74 |
include ../../../../../make_helpers/common.mk |
| 75 |
+include ../../../../../make_helpers/build_macros.mk |
| 76 |
include ../../../../../make_helpers/toolchain.mk |
| 77 |
|
| 78 |
# Cross Compile |
| 79 |
@@ -31,6 +32,8 @@ C_SOURCES_PMU := src/suspend.c |
| 80 |
# Flags definition |
| 81 |
COMMON_FLAGS := -g -mcpu=$(ARCH) -mthumb -Wall -O3 -nostdlib -mfloat-abi=soft |
| 82 |
CFLAGS := -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-common |
| 83 |
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 |
| 84 |
+CFLAGS += $(call cc_option, --param=min-pagesize=0) |
| 85 |
ASFLAGS := -Wa,--gdwarf-2 |
| 86 |
LDFLAGS := -Wl,--gc-sections -Wl,--build-id=none |
| 87 |
|