Commit 4ce460a
zephyr: keep project CFLAGS off Zephyr internals
Forwarding mlkem-native CFLAGS into the Zephyr app build is intentional:
it keeps the Zephyr test and benchmark sources on the same warning policy
as the normal make build, including `-Werror`, `-Wpedantic`, `-Wconversion` and
`-Wsign-conversion`. Keep that behavior. The mlkem-native app sources still receive
the expanded flags explicitly through `ZEPHYR_TEST_CFLAGS`.
The failure was that the same flags also reached Zephyr's own CMake build
through the process environment. In the NUCLEO-N657X0-Q benchmark action,
the composed `--cflags="${inputs.cflags} ${inputs.archflags}"` becomes a
single space when both inputs are empty. scripts/tests treats that as a
non-empty value and exports `CFLAGS`. GNU make then appends mlkem-native's
default warning policy to `CFLAGS` and, because `CFLAGS` originated in the
environment, exports it to recipe children. CMake imports that environment
`CFLAGS` value into the global Zephyr build, so Zephyr internals such as
lib/heap/heap_constants.c are compiled under mlkem-native's pedantic
warning policy and fail with `-Werror`.
Do not weaken mlkem-native's flags, and do not stop forwarding them to the
Zephyr app. Instead, run the Zephyr CMake configure and build steps with
`CFLAGS`, `CXXFLAGS`, `CPPFLAGS` and `LDFLAGS` unset. This keeps the deliberate
strict policy on the mlkem/test sources via `ZEPHYR_TEST_CFLAGS` while leaving
Zephyr-controlled sources under Zephyr's own warning policy.
This did not fire in the Zephyr functional tests because that path passes an
empty `--cflags=""` value, together with `--no-auto`, so scripts/tests does not
export `CFLAGS`. The hardware benchmark path was different: its action always
joins cflags and archflags with a space, producing the non-empty " " case
that triggered the environment leak.
Signed-off-by: Brendan Moran <brendan.moran@arm.com>1 parent 0922724 commit 4ce460a
1 file changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
113 | 116 | | |
114 | 117 | | |
115 | 118 | | |
116 | | - | |
| 119 | + | |
117 | 120 | | |
118 | 121 | | |
119 | 122 | | |
| |||
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
126 | | - | |
| 129 | + | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| |||
0 commit comments