raiden00pl commented on PR #21999: URL: https://github.com/apache/nuttx/pull/21999#issuecomment-7060279365
@xiaoxiang781216 @jingfei195887 @GUIDINGLI This change pulls the whole `printf` engine into images that don't use any filesystem. `sync()` is always linked, because `fs_reboot_initialize()` registers it as a reboot notifier. Now `sync()` also calls `foreach_inode()`, and `foreach_inodelevel()` builds paths with `snprintf()`. Images without a console or any `printf()` call now link `snprintf()` and the `vsprintf` code. Measured on `nucleo-f302r8` (`CONFIG_DEFAULT_SMALL=y`, LTO), GCC 16.2, master 1eedefaeb0 with and without this PR (#21999 + #22046 reverted): | image | without this PR | with this PR | |---|---|---| | minimal, no console, no files | 7272 B | 9148 B (**+1876 B, +26%**) | | hello world with console | 21744 B | 21988 B (+244 B) | In the minimal image: `snprintf` +1236 B, `foreach_inode`/`foreach_inodelevel` +328 B, plus `sync()` code. With `CONFIG_DISABLE_MOUNTPOINT=y` the image goes back to 7260 B. So a minimal image grows by a quarter, to walk mountpoints that don't exist. Could the path in `foreach_inodelevel()` be built without `snprintf()` (`"/%s"` needs only `strlcpy()`), or could `sync()` skip mountpoints when nothing is mounted? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
