jingfei195887 commented on PR #21999: URL: https://github.com/apache/nuttx/pull/21999#issuecomment-7090621244
@raiden00pl Thanks for measuring this, I reproduced it. The fix is in #22166. `nucleo-f302r8:nsh` reduced to a minimal image (`CONFIG_DEFAULT_SMALL=y`, `CONFIG_LTO_FULL=y`, `CONFIG_INIT_NONE=y`, no USART/console, no `/dev` nodes, no procfs/romfs/tmpfs), master b2b0bde9d0f. Flash = text + data: | image | gcc 10.3 | gcc 13.2 | printf in image | |---|---:|---:|---| | master with #21999 + #22046 reverted | 12152 | 12048 | no | | master | 15672 (+3520) | 15576 (+3528) | yes | | master + #22166 | 13220 (+1068) | 13116 (+1068) | no | | master + #22166 + `CONFIG_DISABLE_MOUNTPOINT=y` | 12124 | 12024 | no | The growth is larger than in your numbers because with these compilers the printf engine also pulls in `__udivmoddi4` (~700 B). #22166 builds the path in `foreach_inodelevel()` with `strlcpy()` instead of `snprintf()`, which removes the printf engine (about 2.4 KB here). The remaining ~1 KB is the mountpoint walk itself: `sync()` (inlined into the reboot handler), `foreach_inodelevel()` and `mountpt_syncfs()`. Images that need to drop that too can set `CONFIG_DISABLE_MOUNTPOINT=y`, which brings them back to the size before #21999. Note that in images that register any driver or open a file, printf is already linked by `inode_search_setup()` and `dir_allocate()`, so #22166 only saves size where `foreach_inode()` was the last printf user, as in your minimal image. -- 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]
