Skip to content

workaround for problems with relocation on the x32 architecture #155

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

Closed
wants to merge 9 commits into from

Conversation

czurnieden
Copy link
Contributor

A proposal for a workaround for the x32 relocation problem.

@sjaeckel
Copy link
Member

sjaeckel commented Feb 4, 2019

@dod38fr can you please try if this solves the problems described in #154 ?

@dod38fr
Copy link

dod38fr commented Feb 5, 2019

@sjaeckel I'm trying first a newer version of libtool as debian wiki mentions that old libtool may trigger issues related to relocation (although the error messages between the wiki and the logs are not the same). As it happens, I've a Debian bug that asks me to stop using old version of libtool while building Debian package...

After that, I'll try this patch.

@czurnieden
Copy link
Contributor Author

@dod38fr seems to work with the patch attached to bug 912838. Please drop a note when it is official, so I can declare this branch as obsolete and delete it. (it's nothing I would mourn for, it wasn't the most elegant piece of code in the first place ;-) ) Is it known what libtool bug(s) caused it?

@czurnieden
Copy link
Contributor Author

@dod38fr No, I have to take it back, sorry. Seems as if I did a bad job cleaning all caches. *sigh*

@dod38fr
Copy link

dod38fr commented Feb 7, 2019

@czurnieden I've uploaded a libtommath version 1.1.0-3~exp1 to debian experimental. This new verson contains the patch of this PR.

The build results look good on x32.

@czurnieden
Copy link
Contributor Author

@dod38fr saw the problems with m68k, tried a patch. See #156 if you want to give it a try.

@sjaeckel sjaeckel requested a review from minad February 10, 2019 22:30
Copy link
Member

@minad minad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not convinced that the visibility attributes are a good solution. What is the reason for the relocation error?

Furthermore we should decide on an API concerning the tuning parameters instead of exposing mp_get_KARATSUBA_* and mp_set_KARATSUBA_* functions depending on compile flags.

@czurnieden
Copy link
Contributor Author

I am not convinced that the visibility attributes are a good solution.

Neither am I, but that is the best solution offered yet. One of the better solutions would be getter/setter functions.

What is the reason for the relocation error?

The linker does not know enough at linking time and thinks it needs to export them outside of the lib, too. A short search with Google shows some results that seem to show a tendency to accept it, the visbility(hidden) that is, as good enough. Vid. e.g.: https://bugs.chromium.org/p/webm/issues/detail?id=46#c6

Furthermore we should decide on an API concerning the tuning parameters instead of exposing mp_get_KARATSUBA_* and mp_set_KARATSUBA_* functions depending on compile flags.

Tuning is a one-time activity at compile time and I think a macro should suffice, as long as it is documented. Everything else needs some automatic configuration method (e.g.: autoconf).

@sjaeckel
Copy link
Member

@dod38fr do I understand correctly that debian on x32 builds now without this patch? (after you updated libtool)

@dod38fr
Copy link

dod38fr commented Feb 11, 2019

@sjaeckel No. This PR is required to build Debian on x32. The libtool update did not change the result

All the best

@sjaeckel sjaeckel added this to the next milestone Feb 11, 2019
@minad
Copy link
Member

minad commented Feb 11, 2019

@czurnieden Since these tuning parameters should be constant, could we instead use macros? Then we could allow overwriting these macros for tuning.

#ifndef KARATSUBA_CUTOFF
#define KARATSUBA_CUTOFF value-determined-by-tuning
#endif

Compilation for the demo will then overwrite this as follows

#define KARATSUBA_CUTOFF get_karatsuba_cutoff()

and the function can be defined in the tuning program. This would reduce the ugliness of this issue a bit. We would still need the visibility attributes though.

This was referenced Mar 4, 2019
@sjaeckel sjaeckel modified the milestones: next, v1.1.1 Mar 26, 2019
@sjaeckel
Copy link
Member

sjaeckel commented Apr 2, 2019

I don't like the idea of having a different ABI&API on x32 than on the other architectures, so I'm also tending towards a "won't fix" until 2.0.0

@dod38fr which way do you suggest to go? what do the debian guidelines say?

@minad
Copy link
Member

minad commented Apr 2, 2019

Wontfix is appropriate 👍 x32 is a dead end.

@sjaeckel
Copy link
Member

@dod38fr would it be fine for you (and debian) if we won't fix this? I also don't see much future for x32

@dod38fr
Copy link

dod38fr commented May 18, 2019

@sjaeckel x32 is not "officially" supported by Debian, so skipping x32
is fine.

This means that perl6 and some other reverse dependencies like
firebird won't be available on x32. I suspect that nobody will
complain.

I'll remove this arch from the list of target of libtomath
package.

@czurnieden
Copy link
Contributor Author

I'll remove this arch from the list of target of libtomath package.

Ah, thanks! One headache less.

@minad
Copy link
Member

minad commented May 18, 2019

Ok good, I close this then. If the need comes up from the perl6 guys or other interested parties, this issue can be reopened.

@minad minad closed this May 18, 2019
@sjaeckel sjaeckel modified the milestones: v1.1.1, next Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants