Skip to content

Conversation

@AxlLind
Copy link

@AxlLind AxlLind commented Sep 25, 2025

even if logging is disabled, the strings are still included in the binary. This is because the compiler does not see that wolfSSH_Log() is compiled as a noop (perhaps solved with lto, haven't tried).

By making WLOG a noop if wolfSSH_Log is we reduce the compiled so-file by ~50k (about 25%).

Compiling on my machine for linux x86_64 libwolfssh.so.7.10.2 goes from 197k to 144k. This seems significant.


One downside is potential warnings about variables which are only used in WLOG invocations. This only happened in one place in the code base, so I would argue it's worth it.

@wolfSSL-Bot
Copy link

Can one of the admins verify this patch?

even if logging is disabled, the strings are still
included in the binary. This is because the compiler
does not see that wolfSSH_Log() is compiled as a noop.

By making WLOG a noop if wolfSSH_Log is we reduce the
compiled so-file by ~50k (about 25%).
@AxlLind
Copy link
Author

AxlLind commented Sep 25, 2025

I see now that log.h is included in installations. Are users meant to use WLOG from their ssh clients/servers? If so they might not have the same defines when compiling, which could cause issues.

@JacobBarthelmeh JacobBarthelmeh self-assigned this Oct 7, 2025
@JacobBarthelmeh
Copy link
Contributor

JacobBarthelmeh commented Oct 7, 2025

Thanks @AxlLind for the suggestion! I'm going to treat this as a bug/enhancement report and open a pull request shortly for it. If you have some more changes in mind, please reach out to [email protected] to go through being setup as a contributor. Again the feedback on wolfSSH and suggested code changes is greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants