Richard Kreckel [Sat, 23 Apr 2022 23:14:14 +0000 (01:14 +0200)]
Fix ARM implementation of mulusmall_loop_up(digit, ptr, len, newdigit)...
...by removing the shortcut for small 'digit' and calling
mulu32_64_vregs instead (which handles digits >= 2^16 fine).
The requirement that 'digit' be small (<= 36) is documented in cl_DS.h
but nowhere enforced. Indeed, it is clearly violated in the base-N
input function digits_to_I_baseN().
I am not sure what to do. This ARM asm seems to be the only code which
relies on small 'digit'. A future patch should either fix the input
method to guarntee that 'digit' is small or accept that it can be
large and remove the shortcut in mulusmall_loop_up for good (and also
fix the comments in cl_DS.h).
Richard Kreckel [Fri, 5 Nov 2021 11:31:59 +0000 (12:31 +0100)]
Update and clean up autoconf template files.
This is needed for compatibility with newer autoconf:
* Removed several unused m4 macros.
* Removed support for traditional C decl in CL_PROTO_TRY.
* Remove check for perror(), which is standard C++11.
* Remove ax_cxx_compile_stdcxx.m4 (it is pulled in by autogen.sh).
* Ran autoupdate on remaining files.
Richard Kreckel [Thu, 4 Nov 2021 10:25:23 +0000 (11:25 +0100)]
Fix linking errors on some compilers.
Let's be explicit about variables with C language linkage [dcl.link]:
- 'type x;' declares and defines C++ variable 'x'.
- 'extern "C" type x;' declares 'x' (with C linkage).
- 'extern "C" { type x; }' declares and defines 'x'.
The C++ standard allows mixed declarations as long as they denote the
same entity, but some compilers (e.g. CLang) don't seem to comply.
It doesn't hurt to be explicit and use extern "C" throughout for the
affected variables.
Reported by Philip Huffman <philhuffman56@icloud.com>.
cmake: defined `short_little_endian`, `int_little_endian` macros
... so CL_CPU_BIG_ENDIAN_P is set in src/base/cl_sysdep.h both for
autotools and CMake builds.
Note 1.
Checking for endianness of both `short` and `int` is necessary only
for 16-bit systems (where `short` can be 8-bit). I doubt anyone is
going to run CLN on such systems in the 21st century. Nevertheless
CMake does the right thing even for such targets (i.e. it tries to
find a 16-bit integer type and figure out its endianness).
Note 2.
These days (circa 2021) the vast majority of CPU architectures are
little endian, so the problem is mostly irrelevant.
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:24 (message):
Source directory has been already configured by configure script. Please
run `make distclean` in /home/asheplyakov/work/sw/cln and try again.
[build] Use autoconf to find out cl_word_alignment.
This way there's no need to define cl_word_alignment for every CPU. Also we
can stop exposing __$cpu__ macros in the public headers (for one our macros
conflict with compiler defined ones).
Richard Kreckel [Mon, 19 Oct 2020 08:36:57 +0000 (10:36 +0200)]
Replace unused macro with cl_unused.
It has become customary to use 'unused' within bitfields. Better avoid
this conflict. This fixes cross-compilation issues on several ARM-based
host platforms.
Richard Kreckel [Sat, 17 Oct 2020 22:23:28 +0000 (00:23 +0200)]
Assume types 'long long int' and 'long double' exist.
The C++11 standard requires in 3.9.1-2 that type 'long long int' exists
and in -8 that type 'long double' exists. So, remove macros HAVE_LONGLONG
and HAVE_LONGDOUBLE. Also, shamelessly update m4/param.m4, m4/intparam.m4,
and m4/floatparam.m4 with code from CLisp.
All this fixes several cross-compilation issues discovered by
Helmut Grohne <helmut@subdivi.de>.
Commit 2f799401454292 (`Replace typedef int[<negative>] trick with static_assert.`)
breaks cross compilation due to invalid `include/cln/intparam.h` header
produced by the configure script.
CL_INTPARAM_BITSIZE relies on integer multiplication overflow to find out
the bit size of various integer types. However singed integer overflow
is an undefined behavior. Apparently in some contexts GCC uses mod 2^N
arithmetics to evaluate the signed integer expressions. As a result
`typedef int[2*((T)((T)2 * ... * (T)2) == 0) - 1]` trick works with both
signed and unsigned integers (and gives the correct result).
Howerver GCC considers an expression involving an integer overflow as
a non-constant, and refuses to use it in `static_assert`:
As a result `static_assert((T)((T)2 * ... * (T)2) == 0, "")` never holds
since either 1) the condition can't possibly hold without an overflow,
or 2) GCC rejects the expression when the overflow occurs.
Keep using the old good `typedef int[negative]` in CL_INTPARAM_BITSIZE
to avoid the problem.
Bruno Haible [Sat, 26 Oct 2019 14:52:28 +0000 (16:52 +0200)]
Revamp and simplify autoconfiguration.
- New file autogen.sh.
- Put build scripts in build-aux/ not autoconf/.
- Install lib-*.m4 and config.rpath through gnulib module 'havelib'.
- Install 'test-driver' through automake.
YunQiang Su [Sun, 18 Mar 2018 11:05:51 +0000 (12:05 +0100)]
Support MIPS release 6.
MIPS release 6 is not full compatible with the previous releases, it removes
some instructions and changes encoding of some instruction.
the `multu' is included.
MIPS r6 drops `lo' and `hi' registers, and then removes `multu'/`mfhi'/`mflo'.
Instead it uses `mulu' to compute the low part and `muhu' to compute
the high part.