-
Notifications
You must be signed in to change notification settings - Fork 7
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
WIP: Let bearssl be trimmed during linking to static lib #54
base: master
Are you sure you want to change the base?
Conversation
Right, this reminds me of the following: https://stackoverflow.com/questions/53414293/gcc-differently-treats-an-object-and-a-static-library-regarding-undefined-symbol - ie there's a difference of linking objects vs static libraries - maybe there's a way to get the static-library-like linking even when using object files? something to investigate.. |
How about this latest change? This lets library users keep the existing behavior: nim c myprog.nim Or compile with their own nim c -d:bearStaticLibPath=/path/to/libbearssl.a myprog.nim |
the thing missing here above all is the step that ensures that the static library corresponds to the actual source code of bearssl and is compiled using the same options, compiler and flags as the nim code (optimization flags, LTO etc) - this is the difficulty when working with the way one would typically get the same end result with a modern toolchain is to do LTO + whole-program optimisation or possibly function/data sections ( |
Thanks for taking a look! I'll admit that I don't have recent expertise with compiling, so if you think it's not a good idea, that's fine. I'm not clear if you're worried about things being broken because of this change, or if you're just worried they won't be optimal.
This PR makes linking to a
By "same end result" here, do you mean the trimming unused bearssl symbols magic that BearSSL does? Again, thanks for taking the time (and for publishing this library). |
This addresses #53
I found the key in
bearssl/csources/README.txt
:So with the code in this PR, I do the following on macOS:
And get this output:
It works! (At least for MD5).
But I don't know the correct way to change this library to either build the static lib or get users to build the static lib themselves. Thoughts?