-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Logging] log context redefined with XCC when use zephyr logging api with SOF #43786
Comments
This is due to the use of |
You mean I should create a function which wraps LOG_INF/LOG_ERR/LOG_WRN/LOG_DBG, and use LOG_MODULE_DECLARE() within the function? This looks like four functions, because we have four log levels. Could you please explain more detailed |
Since those inline functions call, e.g., |
Multiple use of static inline functions across different C files will result in same symbol names defined in all of the corresponding object files, because XCC compiler emits the same symbol names based on the source file for those static variables inside functions. If Zephyr logging is used in SOF, we will have log context redefinition issue with XCC due to above reason. This patch workarounds the issue by removing the log calls in static inline functions that are used across multiple C files if Zephyr is used. BugLink: zephyrproject-rtos/zephyr#43786 Signed-off-by: Chao Song <[email protected]>
Once the PR in SOF is merged, could you close this issue once you have confirmed that it is no longer an issue? Thanks. |
Multiple use of static inline functions that call Zephyr logging API across different C files will result in same symbol names defined in all of the corresponding object files with XCC, because XCC compiler emits the same symbol names based on the source file for those static variables inside functions. If Zephyr logging is used in SOF, we will have log context redefinition issue with XCC due to above reason. This patch workarounds the issue by removing the log calls in static inline functions that are used across multiple C files if Zephyr is used. BugLink: zephyrproject-rtos/zephyr#43786 Signed-off-by: Chao Song <[email protected]>
Multiple use of static inline functions that call Zephyr logging API across different C files will result in same symbol names defined in all of the corresponding object files with XCC, because XCC compiler emits the same symbol names based on the source file for those static variables inside functions. If Zephyr logging is used in SOF, we will have log context redefinition issue with XCC due to above reason. This patch workarounds the issue by removing the log calls in static inline functions that are used across multiple C files if Zephyr is used. BugLink: zephyrproject-rtos/zephyr#43786 Signed-off-by: Chao Song <[email protected]>
Since the PR in SOF has been merged, is this still an issue for you? |
Liam suppose this will be fixed later, alright, let's close for now. |
On sof zephyr ipc4 build, component performance profiling logs can't be enabled due to current xcc compiler does not support inline logging in header file, logs as below: log_level undeclared (first use in this function) log_current_const_data undeclared (first use in this function) Move comp_copy to component.c can resolve this limitation. However, this brings another cmocka issue for mixer unit test, this patch also fixed cmocka mixer unit test issue. BugLink: zephyrproject-rtos/zephyr#43786 Signed-off-by: Baofeng Tian <[email protected]>
On sof zephyr ipc4 build, component performance profiling logs can't be enabled due to current xcc compiler does not support inline logging in header file, logs as below: log_level undeclared (first use in this function) log_current_const_data undeclared (first use in this function) Move comp_copy to component.c can resolve this limitation. However, this brings another cmocka issue for mixer unit test, this patch also fixed cmocka mixer unit test issue. BugLink: zephyrproject-rtos/zephyr#43786 Signed-off-by: Baofeng Tian <[email protected]>
Describe the bug
According to the document here: https://docs.zephyrproject.org/latest/reference/logging/index.html, I defined log context with LOG_MODULE_REGISTER or LOG_MODULE_DECLARE, and for inline functions in header file, I used LOG_MODULE_DECLARE within that function. But I can not compile SOF application with XCC, and GCC is good.
Errors when use XCC to compile:
Patch to replace SOF log calls with zephyr API:
5411.patch.txt
If I make some functions not inline, the issue can not be reproduced: thesofproject/sof#5459
To Reproduce
git clone https://github.com/thesofproject/sof.git
./script/xtensa-build-zephyr.py -c
./script/xtensa-build-zephyr.py tgl
Or with zephyr style, you can apply my patch to SOF module, and build SOF.
Expected behavior
SOF replace with zephyr logging api, it should be built.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: