From f21e3bc823547c9cac5b36ba2f8358ab806b7ce3 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Tue, 9 May 2023 13:18:51 +0000 Subject: doc: zephyr_troubleshooting: add a note about macro expansion Add a note about the new config option CONFIG_COMPILER_TRACK_MACRO_EXPANSION, and also add an example on how to disable LTO without changing the project file itself. BUG=none TEST=check the page on gitiles Change-Id: I3af8b5ba4f8a0e59a419e426baa4d5460040e86c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4516858 Commit-Queue: Fabio Baltieri Tested-by: Fabio Baltieri Reviewed-by: Keith Short --- docs/zephyr/zephyr_troubleshooting.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/zephyr/zephyr_troubleshooting.md b/docs/zephyr/zephyr_troubleshooting.md index aa6980a9d5..3f3cc508cc 100644 --- a/docs/zephyr/zephyr_troubleshooting.md +++ b/docs/zephyr/zephyr_troubleshooting.md @@ -135,13 +135,23 @@ example a missing `struct device` can show as /tmp/ccCiGy7c.ltrans0.ltrans.o:(.rodata+0x6a0): undefined reference to `__device_dts_ord_75' ``` -Adding `CONFIG_LTO=n` to the corresponding `prj.conf` usually results in more -useful error messages, for example: +Adding `CONFIG_LTO=n` to the corresponding `prj.conf` or building with `zmake +build -DCONFIG_LTO=n` usually results in more useful error messages, +for example: ``` modules/ec/libec_shim.a(adc.c.obj):(.rodata.adc_channels+0x58): undefined reference to `__device_dts_ord_75' ``` +## Macro Error Expansion + +GCC errors on macros include macro expansion by default. This usually results +in a wall of errors that makes it very hard to identify the actual problem. For +these situations it's useful to disable macro expansion entirely by setting +`CONFIG_COMPILER_TRACK_MACRO_EXPANSION=n`, for example by building with: + +`zmake build -DCONFIG_COMPILER_TRACK_MACRO_EXPANSION=n` + ## Build artifacts The buildsystem can be configured to leave the build artifact next to the -- cgit v1.2.1