Skip to content
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

Annotate public symbols and hide the rest #1652

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

evelikov
Copy link

@evelikov evelikov commented Jun 1, 2021

Currently we export all the symbols from both the weechat executable and
each of the plugins.

Introduce WEECHAT_PUBLIC macro annotating the respective symbols and
hide everything else.

As a result, we shave around 10% of the size of each binary. Savings
should be even more if LTO is used.

Note: since cmake is the only officially supported build system, I did
not bother with autotools.

Signed-off-by: Emil Velikov [email protected]

Currently we export all the symbols from both the weechat executable and
each of the plugins.

Introduce WEECHAT_PUBLIC macro annotating the respective symbols and
hide everything else.

As a result, we shave around 10% of the size of each binary. Savings
should be even more if LTO is used.

Note: since cmake is the only officially supported build system, I did
not bother with autotools.

Signed-off-by: Emil Velikov <[email protected]>
@evelikov
Copy link
Author

Hmm just realised that this will cause problems with the weechat backtrace functionality. In particular:
The existing code relies on backtrace(3) which in its essence seems to work by mandating all the symbols to be exported. On the other hand a far more elegant solutions is to use libunwind(3).

This ancient Xorg commit demonstrates the amount of work and most importantly quality of the backtrace across the two. I will work on adding libunwind support as a prep step.

@evelikov
Copy link
Author

For anyone following, this is a bit more involving than expected.

The rdynamic & backtrace to libunwind port was trivial.

Although the tests are failing since they use internal API:

  • the weechat one is indirectly exposed via the plugin API, yet the test is not registering an API at that point
  • plugin implementation details

Fixing that results in more convoluted circular dependencies... we already have some. That can be trivially resolved with OBJECT libraries, which requires cmake 3.12 yet it is missing on older Debian/Ubuntu. More elaborate fix of the circular deps requires some reshuffle on the headless/curses side...

So I'm slowly shaving away this lovely yak 😁

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.

None yet

1 participant