-
Notifications
You must be signed in to change notification settings - Fork 284
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
Add STRICT_ABI cmake flag to generate export lists. #117
Conversation
This depends on making old group chats a supported API. On hold until then. |
So, why not tell gcc/clang not to export all the symbols by default (like msvc++ does), mark public API with |
Mainly because libvpx is a really weird beast. In particular, its A little more detail on the libvpx issue: if you want to create a statically linked libtoxav.so that contains all its dependencies (you want that e.g. for Android), you need to compile the dependencies with Review status: 0 of 2 files reviewed at latest revision, all discussions resolved, some commit checks broke. Comments from Reviewable |
And yet one more clarification: the issue is that libvpx contains asm code that is not PIC enough for Linux/amd64 linkers. Hiding the symbol allows the linker to make static calls to it. Adding our own EXPORT macros would not help, because our dependency is misbehaving anyway. Review status: 0 of 2 files reviewed at latest revision, all discussions resolved, some commit checks broke. Comments from Reviewable |
I get this.
I don't get this. What libvpx has to do with this all? Building a static version of a library doesn't necessarily mean that it should have all of its dependencies statically linked into it. If you build static toxav and link it against shared libvpx — that should work. Also if you build static toxav and link it against static libvpx — that should work too, as long as libvpx can be built statically in the first place. Btw, how |
Reviewed 2 of 2 files at r1. CMakeLists.txt, line 407 [r1] (raw file):
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\nurupo>sh
"sh" is not recognized as an internal or external command,
operable program or batch file Comments from Reviewable |
If you link libvpx statically on a platform that doesn't care as much about PIC as amd64 does, you'll end up with a libtoxav exporting all of libvpx, which you probably don't want. Building and linking libvpx is possible on systems that do care by having this explicit export list. The difference between .ld files and symbol lists in headers is that the latter only affects those specific symbols, not the symbols defined in libraries we depend on. Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks broke. CMakeLists.txt, line 407 [r1] (raw file):
|
Ah, I see. Another question: why with the
If only tox.h and toxav.h symbols are exported in the Review status: all files reviewed at latest revision, all discussions resolved, some commit checks broke. Comments from Reviewable |
If we used the version script flag to link the other libraries, that would be an issue. We don't, however, since version script is only used for toxcore and toxav. If we reach the end goal of #119, then the layers will each also have a version script. For now, they just export everything. This still fixes the issue, because really only toxav needs the version script to work. I added toxcore for consistency and because I do want to have version scripts on all libraries at some point. Once a library has a stable public api, I want a version script to enforce its abi. Review status: all files reviewed at latest revision, all discussions resolved, some commit checks broke. Comments from Reviewable |
Why only toxav really needs a version script? Does libvpx have a potential to change the ABI of toxav.so (e.g. offset the addresses of all the toxav symbols) without toxav changing its own ABI? If toxav symbols are the first one in the toxav.so and the libvpx symbols come after it, libvpx shouldn't be able to change ABI of toxav.so, but if it's the other way around (or random), then i see how that might be an issue. |
libvpx won't change the ABI, but linking libvpx.a into a libtoxav.so (statically) will expose libvpx symbols through libtoxav.so. This is not so bad (though also not so great), but the main problem is that the linker must expose all those symbols in the symbol table, requiring all of them to be backed by position independent code. Not all libvpx symbols are PIC, making an attempt at such linking fail. Review status: all files reviewed at latest revision, all discussions resolved, some commit checks broke. Comments from Reviewable |
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks broke. Comments from Reviewable |
d11c5d2
to
0d83a8f
Compare
@nurupo I've changed it a bit (using |
Reviewed 2 of 2 files at r2. Comments from Reviewable |
Enabling this flag will generate and use an LD version script. It ensures that the dynamic libraries (libtoxcore.so, libtoxav.so) only export the symbols that are defined in their public API (tox.h and toxav.h, respectively).
Enabling this flag will generate and use an LD version script. It
ensures that the dynamic libraries (libtoxcore.so, libtoxav.so) only
export the symbols that are defined in their public API (tox.h and
toxav.h, respectively).
This change is