libtom / tomsfastmath

TomsFastMath is a fast public domain, open source, large integer arithmetic library written in portable ISO C.
http://www.libtom.net
Other
213 stars 66 forks source link

Fix compile error on armv7 #25

Closed fedegiova closed 4 years ago

fedegiova commented 4 years ago

Force arm mode to fix compilation on armv7

Error: thumb conditional instruction should be in IT block -- `movcs r9,libtom#1'

also remove matching constraint and set variables as input output to fix the following warning

warning: matching constraint does not allow a registe

Both errors are present in the develop and the master branch ( compile with -DTFM_ARM)

Copied the assembly optimized thumb routine from here: https://coral.googlesource.com/busybox/+/refs/heads/release-chef/networking/tls_pstm_montgomery_reduce.c

sjaeckel commented 4 years ago

Did you check with the author whether it's okay to re-license this GPL-licensed code under The Unlicense?

fedegiova commented 4 years ago

Your concerns are perfectly fine, sorry for missing it from the beginning. I've searched it for a while and it seems that the original code comes from matrixssl which is GPL2, which I assume incompatible, so I'm closing the pull request and removing the code since there isn't anything else that can be done.

Maybe we can at least keep the #ifdef thumb2 and issue a compiler error or a warning since the included assembly is invalid in thumb2 mode. I've tried to force the mode to arm with .arm .align but I only got a segfault.