diff --git a/ChangeLog b/ChangeLog index e3dccf7..694af2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-12-14 Richard Kreckel + + * include/cln/modules.h, include/cln/object.h: add support for + s390. + * src/numtheory/cl_nt_sqrtmodp.cc: workaround for GCC2.x compiler-bug + on s390, provided by Gerhard Tonn. + 2001-11-05 Richard Kreckel * autoconf/ltmain.sh: Upgrade to libtool-1.4.2. diff --git a/include/cln/modules.h b/include/cln/modules.h index ff05894..22f7c19 100644 --- a/include/cln/modules.h +++ b/include/cln/modules.h @@ -64,7 +64,7 @@ #endif // Globalize a label defined in the same translation unit. // See macro ASM_GLOBALIZE_LABEL in the gcc sources. - #if defined(__i386__) || defined(__m68k__) || defined(__mips__) || defined(__mips64__) || defined(__alpha__) || defined(__rs6000__) + #if defined(__i386__) || defined(__m68k__) || defined(__mips__) || defined(__mips64__) || defined(__alpha__) || defined(__rs6000__) || defined(__s390__) // Some m68k systems use "xdef" or "global" or ".global"... #define CL_GLOBALIZE_LABEL(label) __asm__("\t.globl " label); #endif @@ -152,6 +152,9 @@ #if defined(__ia64__) #define CL_JUMP_TO(addr) ASM_VOLATILE("br " #addr) #endif + #if defined(__s390__) + #define CL_JUMP_TO(addr) ASM_VOLATILE("br %0" : : "a" ((void*)(addr))) + #endif #ifdef CL_GLOBAL_DESTRUCTOR_PREFIX #define CL_PROVIDE(module) \ extern "C" void cl_module__##module##__firstglobalfun () {} \ diff --git a/include/cln/object.h b/include/cln/object.h index 02dd64e..b22e78f 100644 --- a/include/cln/object.h +++ b/include/cln/object.h @@ -22,7 +22,7 @@ namespace cln { #if defined(__m68k__) #define cl_word_alignment 2 #endif -#if defined(__i386__) || defined(__mips__) || defined(__sparc__) || defined(__hppa__) || defined(__arm__) || defined(__rs6000__) || defined(__m88k__) || defined(__convex__) +#if defined(__i386__) || defined(__mips__) || defined(__sparc__) || defined(__hppa__) || defined(__arm__) || defined(__rs6000__) || defined(__m88k__) || defined(__convex__) || defined(__s390__) #define cl_word_alignment 4 #endif #if defined(__alpha__) || defined(__mips64__) || defined(__sparc64__) || defined(__ia64__) diff --git a/src/numtheory/cl_nt_sqrtmodp.cc b/src/numtheory/cl_nt_sqrtmodp.cc index 6a74c5f..098c406 100644 --- a/src/numtheory/cl_nt_sqrtmodp.cc +++ b/src/numtheory/cl_nt_sqrtmodp.cc @@ -173,6 +173,16 @@ static const sqrt_mod_p_t cantor_zassenhaus_sqrt (const cl_modint_ring& R, const } } +#if defined(__GNUC__) && defined(__s390__) && (__GNUC__ == 2) // Workaround GCC-bug (see below) + struct cl_sylow2gen_property : public cl_property { + SUBCLASS_cl_property(); + public: + cl_I h_rep; + // Constructor. + cl_sylow2gen_property (const cl_symbol& k, const cl_MI& h) : cl_property (k), h_rep (h.rep) {} + }; +#endif + // Algorithm 3 (for p > 2 only): // Tonelli-Shanks. // [Cohen, A Course in Computational Algebraic Number Theory, @@ -213,6 +223,7 @@ static const sqrt_mod_p_t tonelli_shanks_sqrt (const cl_modint_ring& R, const cl // Since this computation is a bit costly, we cache its result // on the ring's property list. static const cl_symbol key = (cl_symbol)(cl_string)"generator of 2-Sylow subgroup of (Z/pZ)^*"; +#if !(defined(__GNUC__) && defined(__s390__) && (__GNUC__ == 2)) // Workaround GCC-bug (see above) struct cl_sylow2gen_property : public cl_property { SUBCLASS_cl_property(); public: @@ -220,6 +231,7 @@ static const sqrt_mod_p_t tonelli_shanks_sqrt (const cl_modint_ring& R, const cl // Constructor. cl_sylow2gen_property (const cl_symbol& k, const cl_MI& h) : cl_property (k), h_rep (h.rep) {} }; +#endif var cl_sylow2gen_property* prop = (cl_sylow2gen_property*) R->get_property(key); if (prop) h = cl_MI(R,prop->h_rep);