-
Notifications
You must be signed in to change notification settings - Fork 194
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
patch for m68k floats #156
Conversation
@czurnieden Is there a possibility to fix the existing set_double function instead of providing an additional function for mk68 (by accessing the bit pattern). Alternatively I suggest to simply disable set_double support on mk68 as we also do on other platforms which don't provide IEEE754. We can provide a fix as soon as someone comes by who has a working mk68 qemu instance. |
Debian wiki mentions: "As upstream QEMU currently does not provide full m68k CPU support, you need to use a patched version of QEMU which has full m68k CPU support developed by Laurent Vivier. Laurent's version can be found on github". This page also provides instructions to build qemu-m68k on Debian. |
(@dod38fr Laurent Vivier's version does not compile for me, does not find installed libraries, maybe something in the build process, had no time to check it yet.) Was able to get sid's qemu to run which made the error replicable. Sort of, because the error message in Without this patch but the replacement
I got
which seems to point to a bug in qemu's FPU-emulation. It would be nice if somebody is able to verify that with the patched qemu version mentioned above. Or switch it off completely for m68k as @minad suggested. |
Was finally able to build Laurent Vivier's version (had to add |
@czurnieden What is the result in qemu if you use the existing mp_get_double function? Is there an endianness problem? |
@minad I honestly do not know what the problem is. It is not an endian problem in I finally gave up and switched them off for now. Builds and tests ok without. New problem: @dod38fr Lintian returns an error: E: libtommath1: shlib-with-non-pic-code usr/lib/m68k-linux-gnu/libtommath.so.1.1.0 |
|
Found out that the m86k fpus have the same "feature" as e.g.: the x86: hidden bits of extra precision. See e.g.: "The pitfalls of verifying floating-point computations" by David Monniaux arxiv.org and the GCC manpage (entry for Added a small entry in Builds and tests ok now, but the Lintian error is still there. |
There is also fexcess-precision=standard. Does that work too? c99 enables this flag by default. |
@minad that flag influences casts, too, and I wanted to change as little as possible. Oh, and Debian needs C90 compliance as far as i understand it. But otherwise: I see no problem here but it should be documented somewhere. @dod38fr the Lintian error is caused by
Couldn't find anything quickly, no idea, sorry. |
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.
Only changes to the tests and compile flags. Looks good.
libtommath with this PR builds fine on my system. Please make sure that you have an up-to-date lintian on Debian/unstable. Anyway, I've uploaded libtommath patched like this PR as version 1.1.0-3~exp2. The build still fails with :
HTH |
@czurnieden It seems the ffloat-store option is not applied in the build log. Is the ARCH condition in the makefile correct for the cross compiler used by the Debian build server? |
merged with current develop
@dod38fr My buildd system is, despite all efforts, significantly different from that on m68k-do-02.buildd.org? *strokes his sequipedestrial beard* OK, so let's get rid of all that fancy-schmancy newfangled compiler roptions and do it the old and tested way: measure the relative error and check against For those of you who want to try it themselves (or were sent here by Google): Note: my host system is based on Mate 17.1 "Rebecca", a quite old Debian stable system. We are on the host. Get a Build a virtual harddrive with 20G space (way too big, even 10G is more than enough but it clutters quite quickly if you are me ;-) )
Start QEMU and Install (you can take all the defaults with the exception of the keyboard layout if you have a different layout than the english one and you need to install the
I installed a desktop (Mate, the default Gnome is way too slow with QEMU), too, to make things more comfortable for me but your mileage may vary. You cannot simple reboot here, you need to start QEMU again, slightly different, to boot from the virtual disk.
We are now in the guest system. Set display size if needed and make yourself comfortable in the new system by installing all your regularly needed tools like your editor of choice. Once done you can follow the advice at https://wiki.debian.org/M68k/sbuildQEMU which worked for me with the exception of the problem with the missing libraries describe somewhere above in this thread. Get the newest patch from https://packages.debian.org/de/source/experimental/libtommath (at the end, several files, al are needed) which is currently
I start
It either works or not. If not, the most likely outcome if you have the need to do it locally, edit the code and make a patch with:
It is interactive, just fill out the forms. You don't need to edit anything but an individual patch-name is needed. If you mistyped the patchname or have other reasons to get rid of it you need to delete that patch in Start
Rinse and repeat until you get a clean build. That invocation of There are many ways for a communication between the host and the guest. The simplest way if you are in a local network like most of us who are behind a router is via Run Find the IP address of the host, e.g. with Now you can use To copy a file from guest to host: To get a file from the host to the guest It also works if you do not have a local network but I find it it is easier to secure thet way. YMMV, of course. |
Works in my local Oh, and it was indeed a problem with the extra precision. The recursions |
@czurnieden Thank you very much for your efforts! I guess we should not bother too much and just switch the tests off on mk68 if we cannot get it to work in reasonable time. One remark about the change you made - now you are testing using DBL_EPSILON, which is not good enough on IEEE754 compliant platforms. I suggest you use an ifdef in s_compare_doubles to enforce exact equality on those. |
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.
s_compare_doubles should use exact equality on IEEE754 compliant platforms.
@minad What? Oh, you are killing me! ;-) I see that Steffen had already put it to the next milestone. So if you are not OK with it or it fails tests in a way that is not quickly repairable(The Lintian error is still dangling) we should kick m68k support for the get/set_double out of the program. I've already done it in one of teh earlier commits, but I doubt that you can simply merge that old stuff without further massage. As far as I remember: the very last deadline for the Debian freeze is tomorrow, so it should happen today. |
Ok, I suggest to do it as follows:
|
@czurnieden Debian soft-freeze is indeed today. On the other hands, x32 and m68k arches are not part of the "official" release, i.e. a build or test failure in these packages will not stop new libtommath package to enter next Debian stable release. As a matter of fact, libtomath 1.1.0 is already part of testing (See https://tracker.debian.org/pkg/libtommath) so it will be shipped in Buster (the code name for next Debian stable release). So, there's no need to rush a fix for x32 or m68k. All the best |
@dod38fr Thank you for clarification! |
The fact that Lintian failed in the m68k build is caused by adding I could switch it of manually in
And put them behind Ah, forget it, made a commit with the changed makefile. Those additional flags work well (with the
Problem: It all works nice and dandy, yes, wonderful, but on my own machine, a normal x86_64 building for x86_64:
That is caused by a missing I do not know if the problem with PIE is the cause for the x32 problems, too, forgot if I checked it before applying the patch but I doubt it. |
closed in favor of #160 |
Saw that
mp_get_double
has troubles with the m68k architecture . It is a blind patch, I was not able to persuade qemu to do its deeds and my LC II has no FPU (Yes, I am aware of https://www.shiga-med.ac.jp/people/sugimoto%27s/mac/lc2.html ).