-
Notifications
You must be signed in to change notification settings - Fork 203
Rename internals #172
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
Rename internals #172
Conversation
@sjaeckel You mentioned that the non-hidden symbols in the private header are exposed and are thus available to ld etc. This is true. However they still don't belong to neither the API nor the (stable) ABI. If some library users deliberately access hidden symbols (as clearly indicated by the private header), they must assume that those symbols vanish at some point. I would argue that this change improves the API/ABI situation since it makes clear that the ld-exposed symbols with s_ prefix are private, while still being visible. |
This very much collides with 'Such things need to get announced early enough and loud enough and at least two releases in advance.' [1] and therefore I'm not sure what I should do with it now. Also I'm not sure if we shouldn't first make a plan where we want to go, especially in regards to [2], [3] resp. [4], [5] and potentially more... [1] #164 (comment) |
Sorry for repeating myself: Why do you need to announce a change of internals? The possibility of change is implied by the fact that these are marked private. See for example |
but the functions you renamed are not static BTW regarding the 'two releases in advance': I count minor releases, so I don't see this only changing in 3.0.0 how about adding something like this for all renamed functions?
like that we don't break existing stuff but tell the users that it will break in the future sure, if they stick with <1.2.0 until 2.0.0 is out they won't notice and stuff will break, but that's not something we can solve This definitely needs some more work, but we shouldn't just remove stuff that was there forever. |
I recommend the following plan:
|
@sjaeckel Oh, I just saw you commented. You are wrong about "but the functions you renamed are not static". In C++ private static functions are still linker visible as in our case. Our case with private functions in tommath_private.h transfers exactly. Edit: Note that in the ROS guide they mean "class static functions". Sorry for the confusion, shouldn't have linked to that. Therere are probably other ABI guides specific to C. |
Concerning your proposal:
But I don't see a reason for going through the versioning here. And I have yet to see a good argument. Please let you convince otherwise, even if you and @czurnieden's reaction was initially critical to the change. I argue that you are unnecessarily careful. libtommath already has a good separation between private and public and we can use that. |
Well TBH I don't care about C++ semantics and how whatnot translates in theory to this project. If we remove these symbols it will mean
Regarding the ABI bump:
in 2.0.0
see above
ACK
Yes, this needs some work
Yes, the original idea was to merge ltm and tfm. To prevent further drifting apart it should've been done yesterday, but yeah... |
Ok, I stop arguing here since I disagree with your definition of the public ABI. Note that this PR doesn't have any urgency and can be easily merged at some point in time when you see fit in your versioning scheme by just executing the rename.sh script again. It seems on the other points of the plan we agree.
When I started using ltm, I also checked fastmath but it seemed to have a wildly different API and a different purpose using fixed size integers. (Maybe I have to check again). Given that there are a few libraries providing arbitrarily sized integers (ltm, gmp, etc), I think fastmath has its own niche and the two libraries should not be merged. |
there's nothing to argue about, it's not me who defined this http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html |
The reason for the linking error lies in the intricacies of the x64-32 ABI. Basically
Not really. At least no single point of information. I can share some links, but I found none for that exact problem. I could ask at stackoverflow? With a bit of luck we can get somebody who is good at explaining? I think I already had the following link, hadn't I? A general link: Some thoughts about the future of x64_32
The patch itself is correct although a bit too specific for my taste--needs GCC>4 (which is really old, admitted) or Intel's ICC, and ELF, and an x86-64 (ARM has something similar to the x86 specific x64_32 with their arm64 but with a different ABI, not yet tested). Another two links showing how others do it: https://docs.microsoft.com/en-us/cpp/build/exporting-from-a-dll-using-declspec-dllexport?view=vs-2017
It's just for x64_32 wouldn't invest much work into it. You can test for the x64_32 ABI and exclude the whole mess for the rest with the preprocessor. I'm sure it can be done more elegantly as I did it, though. |
Is the x64-32 abi broken in this sense? I have no idea what the technical reason is for this. In theory x64-32 should not be much different from x32 + additional 64bit registers available. I will check out your links... Thank you for collecting them.
Maybe it could help. Would you like to ask? I won't do it since I don't have an account there and there are just to many janitors around over there...
I've read that one before. And I hope that it gets dropped since it is a bad idea. For this reason I would also not put much effort in a fix.
I am pretty sure it can be done more elegantly. But as you said, we shouldn't put effort in it. Just drop the patch and wontfix? |
What I don't get or assuming wrongly - in this x64-32 abi, is the virtual address space not artificially restricted such that only 32 bits are used? Are shared objects still placed arbitrarily within the 48 bit address space for ASLR etc? Then these relocation errors can occur obviously when the address does not fit within the 32 bit R_X86_64_PC32 relocation. |
@sjaeckel rebased and added deprecated functions. now it is 100% abi/api compatible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides those comments 👍
/* define heap macros */ | ||
#ifndef XMALLOC | ||
#ifndef MP_MALLOC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea, but I guess we have to keep these X-versions around until 2.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. You just added CALLOC and removed it etc etc. This is internal API not even ABI. And these are only macros.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an issue. Please! This is a private header!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the deprecated functions to keep the private ABI stable (which is already unnecessary in my opinion). Changes to tommath_private.h are even more minor. Let's change this to move forward :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regarding the deprecated API functions we're forced to keep them, as otherwise we'd have to bump the ABI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
am now tending towards accepting as proposed
A clean-up is necessary, no question, and we have to start at one point in time and (code)space so why not here and now?
at least a 1.2.0 release which announces the deprecation of all this stuff in 2.0.0
Sounds good to me. And gives enough time to "round the edges".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sjaeckel Did you decide to merge this? If you do, ping me and I will update this PR again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, yes please rebase
btw. would you be fine with me rebasing your commits if I sign them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you can also do the rebase without signing, that's ok. You are the committer.
Fixed the MAX/MIN renaming issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This UI is kiilin gme, if this comment comes up multiple times I'll blame MS ;-) )
am now tending towards accepting as proposed
A clean-up is necessary, no question, and we have to start at one point in time and (code)space so why not here and now?
at least a 1.2.0 release which announces the deprecation of all this stuff in 2.0.0
Sounds good to me. And gives enough time to "round the edges".
/* define heap macros */ | ||
#ifndef XMALLOC | ||
#ifndef MP_MALLOC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
am now tending towards accepting as proposed
A clean-up is necessary, no question, and we have to start at one point in time and (code)space so why not here and now?
at least a 1.2.0 release which announces the deprecation of all this stuff in 2.0.0
Sounds good to me. And gives enough time to "round the edges".
@sjaeckel rebased, please merge! |
but not on develop |
@sjaeckel Right I confused a few branches. Now it should be ok. |
I'll merge as soon as travis is done |
On 9Apr, 2019, at 4:17 AM, Steffen Jaeckel ***@***.***> wrote:
But renaming something that was there for ages, only for the sake of consistency, without any other gain, I don't consider as a such important improvement.
Agree
On 9Apr, 2019, at 4:40 AM, Steffen Jaeckel ***@***.***> wrote:
... This change breaks users' implementations if they rely on the fact that they can override XMALLOC etc by defining XMALLOC at compile time of the library.
This entire stuff has been public for ages, then it has been "private" for some time, now we should make it (as possible) really private but this just needs some time (and at least a 1.2.0 release which announces the deprecation of all this stuff in 2.0.0).
I concur. Some consistency across LTM and LTC is desirable, especially for otherwise-common low-level utilities like the MALLOC family. While I personally don't rely on XMALLOC in this way, I easily could when my situation warranted.
That said, I suppose I could support both XMALLOC and MP_MALLOC in tommath_private.h. Then, after a stronger case can be made, perhaps deprecate XMALLOC for later removal?
|
@buggywhip I don't think it is easy to support both macros. You have to check if one or the other is defined etc. Then you have to add some deprecated pragmas as in #223. This is not worth it. People who overwrite the macros of the private API, know what they are doing and they will accept if they change (I am overwriting them for example). |
I like that thought! probably it'd be better to call it
I think so too, even if they're already there for a long time people who overwrite them will (hopefully) know what they do and well then they have to adapt their sources... |
I am not very fond of it. I see tommath and crypt as distinct. Right now I am also only using tommath (maybe also crypt in the future). I would prefer if we can unify all the tommath macros and functions under the mp_* prefix for consistency. I think consistency within the library is more important than consistency between two distinct libraries. |
We could however rename everything to ltm_ and ltc_ and then you can use the lt_ macro, but I think that would really classify as needless renaming. 😆 |
ah I don't know how to name it, but for sure we have to change the signature of the XMALLOC class of macros in ltc as well to the one that is used here... |
I haven't looked at ltc but I would just use the canonical namespace prefix if there is one? |
they're called the exact same as they were called here before XMALLOC XFREE etc. ltm and ltc were once one library and then they got separated... ;-) |
On 12Apr, 2019, at 2:06 PM, Steffen Jaeckel ***@***.***> wrote:
ah I don't know how to name it
Consistency does not have to be sameness. You can have consistency at the paradigm level, and perhaps that is all that is needed here.
|
See #164. These are only internal functions, no API or ABI changes. The renaming is done by the script. If something needs tweaking only the script should be changed and executed again.