[SOLARIS 11, SPARC] compilation failed #1080

issue tankf33der openend this issue on February 25, 2022
  1. tankf33der commented at 2:45 pm on February 25, 2022: none
      0$ nice ./configure 
      1checking build system type... sparc-sun-solaris2.11
      2checking host system type... sparc-sun-solaris2.11
      3checking for a BSD-compatible install... /usr/bin/ginstall -c
      4checking whether build environment is sane... yes
      5checking for a thread-safe mkdir -p... /usr/bin/gmkdir -p
      6checking for gawk... gawk
      7checking whether make sets $(MAKE)... yes
      8checking whether make supports nested variables... yes
      9checking how to print strings... print -r
     10checking whether make supports the include directive... yes (GNU style)
     11checking for gcc... gcc
     12checking whether the C compiler works... yes
     13checking for C compiler default output file name... a.out
     14checking for suffix of executables... 
     15checking whether we are cross compiling... no
     16checking for suffix of object files... o
     17checking whether we are using the GNU C compiler... yes
     18checking whether gcc accepts -g... yes
     19checking for gcc option to accept ISO C89... none needed
     20checking whether gcc understands -c and -o together... yes
     21checking dependency style of gcc... gcc3
     22checking for a sed that does not truncate output... /usr/bin/gsed
     23checking for grep that handles long lines and -e... /usr/bin/ggrep
     24checking for egrep... /usr/bin/ggrep -E
     25checking for fgrep... /usr/bin/ggrep -F
     26checking for ld used by gcc... /usr/bin/ld
     27checking if the linker (/usr/bin/ld) is GNU ld... no
     28checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -p
     29checking the name lister (/usr/bin/nm -p) interface... BSD nm
     30checking whether ln -s works... yes
     31checking the maximum length of command line arguments... 1572480
     32checking how to convert sparc-sun-solaris2.11 file names to sparc-sun-solaris2.11 format... func_convert_file_noop
     33checking how to convert sparc-sun-solaris2.11 file names to toolchain format... func_convert_file_noop
     34checking for /usr/bin/ld option to reload object files... -r
     35checking for objdump... no
     36checking how to recognize dependent libraries... pass_all
     37checking for dlltool... no
     38checking how to associate runtime and link libraries... print -r --
     39checking for ar... ar
     40checking for archiver [@FILE](/bitcoin-core-secp256k1/contributor/file/) support... no
     41checking for strip... strip
     42checking for ranlib... ranlib
     43checking command to parse /usr/bin/nm -p output from gcc object... ok
     44checking for sysroot... no
     45checking for a working dd... /usr/bin/dd
     46checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
     47checking for mt... mt
     48checking if mt is a manifest tool... no
     49checking how to run the C preprocessor... gcc -E
     50checking for ANSI C header files... yes
     51checking for sys/types.h... yes
     52checking for sys/stat.h... yes
     53checking for stdlib.h... yes
     54checking for string.h... yes
     55checking for memory.h... yes
     56checking for strings.h... yes
     57checking for inttypes.h... yes
     58checking for stdint.h... yes
     59checking for unistd.h... yes
     60checking for dlfcn.h... yes
     61checking for objdir... .libs
     62checking if gcc supports -fno-rtti -fno-exceptions... no
     63checking for gcc option to produce PIC... -fPIC -DPIC
     64checking if gcc PIC flag -fPIC -DPIC works... yes
     65checking if gcc static flag -static works... no
     66checking if gcc supports -c -o file.o... yes
     67checking if gcc supports -c -o file.o... (cached) yes
     68checking whether the gcc linker (/usr/bin/ld -64) supports shared libraries... yes
     69checking whether -lc should be explicitly linked in... no
     70checking dynamic linker characteristics... solaris2.11 ld.so
     71checking how to hardcode library paths into programs... immediate
     72checking whether stripping libraries is possible... no
     73checking if libtool supports shared libraries... yes
     74checking whether to build shared libraries... yes
     75checking whether to build static libraries... yes
     76checking whether make supports nested variables... (cached) yes
     77checking for pkg-config... /usr/bin/pkg-config
     78checking pkg-config is at least version 0.9.0... yes
     79checking for ar... /usr/bin/ar
     80checking for ranlib... /usr/bin/ranlib
     81checking for strip... /usr/bin/strip
     82checking for gcc... (cached) gcc
     83checking whether we are using the GNU C compiler... (cached) yes
     84checking whether gcc accepts -g... (cached) yes
     85checking for gcc option to accept ISO C89... (cached) none needed
     86checking whether gcc understands -c and -o together... (cached) yes
     87checking dependency style of gcc... (cached) gcc3
     88checking dependency style of gcc... gcc3
     89checking if gcc supports -Werror=unknown-warning-option... no
     90checking if gcc supports -std=c89 -pedantic -Wno-long-long -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef... yes
     91checking if gcc supports -Wno-overlength-strings... yes
     92checking if gcc supports -Wall... yes
     93checking if gcc supports -Wno-unused-function... yes
     94checking if gcc supports -Wextra... yes
     95checking if gcc supports -Wcast-align... yes
     96checking if gcc supports -Wcast-align=strict... yes
     97checking if gcc supports -Wconditional-uninitialized... no
     98checking if gcc supports -fvisibility=hidden... yes
     99checking for x86_64 assembly availability... no
    100checking that generated files are newer than configure... done
    101configure: creating ./config.status
    102config.status: creating Makefile
    103config.status: creating libsecp256k1.pc
    104config.status: creating src/libsecp256k1-config.h
    105config.status: executing depfiles commands
    106config.status: executing libtool commands
    107
    108Build Options:
    109  with external callbacks = no
    110  with benchmarks         = yes
    111  with tests              = yes
    112  with coverage           = no
    113  with examples           = no
    114  module ecdh             = no
    115  module recovery         = no
    116  module extrakeys        = no
    117  module schnorrsig       = no
    118
    119  asm                     = no
    120  ecmult window size      = 15
    121  ecmult gen prec. bits   = 4
    122
    123  valgrind                = no
    124  CC                      = gcc
    125  CPPFLAGS                =  
    126  SECP_CFLAGS             = -O2  -std=c89 -pedantic -Wno-long-long -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef -Wno-overlength-strings -Wall -Wno-unused-function -Wextra -Wcast-align -Wcast-align=strict -fvisibility=hidden 
    127  CFLAGS                  = -g -O2
    128  LDFLAGS                 = 
    129
    130$ nice gmake
    131gmake  all-am
    132gmake[1]: Entering directory '/export/home/mihailp/secp256k1-master'
    133  CC       src/bench.o
    134In file included from src/bench.c:11:
    135src/util.h:193:43: error: operator '&&' has no right operand
    136  193 |      (defined(_BIG_ENDIAN) && _BIG_ENDIAN == 1)
    137      |                                           ^~
    138src/util.h:198:3: error: #error Please make sure that either SECP256K1_LITTLE_ENDIAN or SECP256K1_BIG_ENDIAN is set, see src/util.h.
    139  198 | # error Please make sure that either SECP256K1_LITTLE_ENDIAN or SECP256K1_BIG_ENDIAN is set, see src/util.h.
    140      |   ^~~~~
    141gmake[1]: *** [Makefile:1130: src/bench.o] Error 1
    142gmake[1]: Leaving directory '/export/home/mihailp/secp256k1-master'
    143gmake: *** [Makefile:886: all] Error 2
    
  2. sipa commented at 7:43 pm on February 25, 2022: contributor
    Can you try compiling with -DSECP256K1_BIG_ENDIAN, since apparently the autodetection based on macros doesn’t work?
  3. real-or-random commented at 11:14 pm on February 25, 2022: contributor

    @tankf33der Can you post the output of this command?

    0echo | gcc -dM -E -
    

    This will help us to improve the autodetection, see https://stackoverflow.com/a/2224357.

    (Judging from the error message, I assume _BIG_ENDIAN is defined but as the empty string instead of 1…)

  4. tankf33der commented at 5:33 am on February 26, 2022: none

    echo | gcc -dM -E -

      0$ echo | gcc -dM -E -
      1#define __DBL_MIN_EXP__ (-1021)
      2#define __UINT_LEAST16_MAX__ 0xffff
      3#define __ATOMIC_ACQUIRE 2
      4#define __FLT128_MAX_10_EXP__ 4932
      5#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F
      6#define __GCC_IEC_559_COMPLEX 2
      7#define __UINT_LEAST8_TYPE__ unsigned char
      8#define __INTMAX_C(c) c ## L
      9#define __CHAR_BIT__ 8
     10#define __UINT8_MAX__ 0xff
     11#define __WINT_MAX__ 0x7fffffff
     12#define __FLT32_MIN_EXP__ (-125)
     13#define __ORDER_LITTLE_ENDIAN__ 1234
     14#define __SIZE_MAX__ 0xffffffffffffffffUL
     15#define __WCHAR_MAX__ 0x7fffffff
     16#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
     17#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
     18#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
     19#define __DBL_DENORM_MIN__ ((double)4.94065645841246544176568792868221372e-324L)
     20#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
     21#define __GCC_ATOMIC_CHAR_LOCK_FREE 2
     22#define __GCC_IEC_559 2
     23#define __FLT32X_DECIMAL_DIG__ 17
     24#define __FLT_EVAL_METHOD__ 0
     25#define __FLT64_DECIMAL_DIG__ 17
     26#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
     27#define __UINT_FAST64_MAX__ 0xffffffffffffffffUL
     28#define __SIG_ATOMIC_TYPE__ int
     29#define __DBL_MIN_10_EXP__ (-307)
     30#define __FINITE_MATH_ONLY__ 0
     31#define __FLT32X_MAX_EXP__ 1024
     32#define __GNUC_PATCHLEVEL__ 0
     33#define __FLT32_HAS_DENORM__ 1
     34#define __UINT_FAST8_MAX__ 0xff
     35#define __FLT32_MAX_10_EXP__ 38
     36#define __INT8_C(c) c
     37#define __INT_LEAST8_WIDTH__ 8
     38#define sparc 1
     39#define __UINT_LEAST64_MAX__ 0xffffffffffffffffUL
     40#define __SHRT_MAX__ 0x7fff
     41#define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L
     42#define __FLT64X_MAX_10_EXP__ 4932
     43#define __FLT64X_HAS_QUIET_NAN__ 1
     44#define __UINT_LEAST8_MAX__ 0xff
     45#define __GCC_ATOMIC_BOOL_LOCK_FREE 2
     46#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128
     47#define __UINTMAX_TYPE__ long unsigned int
     48#define __FLT_EVAL_METHOD_TS_18661_3__ 0
     49#define __unix 1
     50#define __UINT32_MAX__ 0xffffffffU
     51#define __LDBL_MAX_EXP__ 16384
     52#define __FLT128_MIN_EXP__ (-16381)
     53#define __WINT_MIN__ (-__WINT_MAX__ - 1)
     54#define __sun 1
     55#define __FLT128_MIN_10_EXP__ (-4931)
     56#define __INT_LEAST16_WIDTH__ 16
     57#define __SCHAR_MAX__ 0x7f
     58#define __FLT128_MANT_DIG__ 113
     59#define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1)
     60#define __INT64_C(c) c ## L
     61#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
     62#define __SIZEOF_INT__ 4
     63#define __FLT32X_MANT_DIG__ 53
     64#define __USER_LABEL_PREFIX__ 
     65#define __FLT64X_EPSILON__ 1.92592994438723585305597794258492732e-34F64x
     66#define __STDC_HOSTED__ 1
     67#define __DBL_DIG__ 15
     68#define __FLT32_DIG__ 6
     69#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F
     70#define __SHRT_WIDTH__ 16
     71#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L
     72#define __STDC_UTF_16__ 1
     73#define __FLT64X_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F64x
     74#define __FLT32X_HAS_INFINITY__ 1
     75#define __INT32_MAX__ 0x7fffffff
     76#define __unix__ 1
     77#define __INT_WIDTH__ 32
     78#define __SIZEOF_LONG__ 8
     79#define __UINT16_C(c) c
     80#define __DECIMAL_DIG__ 36
     81#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64
     82#define __FLT64X_MIN_10_EXP__ (-4931)
     83#define __LDBL_HAS_QUIET_NAN__ 1
     84#define __FLT64_MANT_DIG__ 53
     85#define __FLT64X_MANT_DIG__ 113
     86#define __GNUC__ 10
     87#define __FLT_HAS_DENORM__ 1
     88#define __SIZEOF_LONG_DOUBLE__ 16
     89#define __BIGGEST_ALIGNMENT__ 16
     90#define __FLT64_MAX_10_EXP__ 308
     91#define __DBL_MAX__ ((double)1.79769313486231570814527423731704357e+308L)
     92#define __INT_FAST32_MAX__ 0x7fffffff
     93#define __DBL_HAS_INFINITY__ 1
     94#define __HAVE_SPECULATION_SAFE_VALUE 1
     95#define __SVR4 1
     96#define __INTPTR_WIDTH__ 64
     97#define __FLT64X_HAS_INFINITY__ 1
     98#define __UINT_LEAST32_MAX__ 0xffffffffU
     99#define __FLT32X_HAS_DENORM__ 1
    100#define __INT_FAST16_TYPE__ int
    101#define __LDBL_HAS_DENORM__ 1
    102#define __FLT128_HAS_INFINITY__ 1
    103#define __DBL_MAX_EXP__ 1024
    104#define __WCHAR_WIDTH__ 32
    105#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32
    106#define __GCC_ATOMIC_LONG_LOCK_FREE 2
    107#define __PTRDIFF_MAX__ 0x7fffffffffffffffL
    108#define __FLT32_HAS_QUIET_NAN__ 1
    109#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
    110#define __SIZEOF_SIZE_T__ 8
    111#define __sparc__ 1
    112#define __FLT64X_MIN_EXP__ (-16381)
    113#define __SIZEOF_WINT_T__ 4
    114#define __LONG_LONG_WIDTH__ 64
    115#define __FLT32_MAX_EXP__ 128
    116#define __GXX_ABI_VERSION 1014
    117#define __FLT_MIN_EXP__ (-125)
    118#define __INT16_MAX__ 0x7fff
    119#define __INT_FAST64_TYPE__ long int
    120#define __FLT128_NORM_MAX__ 1.18973149535723176508575932662800702e+4932F128
    121#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64
    122#define __DBL_MIN__ ((double)2.22507385850720138309023271733240406e-308L)
    123#define __FLT64X_NORM_MAX__ 1.18973149535723176508575932662800702e+4932F64x
    124#define __SIZEOF_POINTER__ 8
    125#define __LP64__ 1
    126#define __DBL_HAS_QUIET_NAN__ 1
    127#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x
    128#define __FLT64_MIN_EXP__ (-1021)
    129#define __FLT64_MIN_10_EXP__ (-307)
    130#define __FLT64X_DECIMAL_DIG__ 36
    131#define __REGISTER_PREFIX__ 
    132#define __UINT16_MAX__ 0xffff
    133#define __DBL_HAS_DENORM__ 1
    134#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32
    135#define __UINT8_TYPE__ unsigned char
    136#define __FLT_DIG__ 6
    137#define __NO_INLINE__ 1
    138#define __sparcv9 1
    139#define __DEC_EVAL_METHOD__ 2
    140#define __FLT_MANT_DIG__ 24
    141#define __LDBL_DECIMAL_DIG__ 36
    142#define __VERSION__ "10.2.0"
    143#define __UINT64_C(c) c ## UL
    144#define __INT_LEAST32_MAX__ 0x7fffffff
    145#define __GCC_ATOMIC_INT_LOCK_FREE 2
    146#define __FLT128_MAX_EXP__ 16384
    147#define __FLT32_MANT_DIG__ 24
    148#define __FLOAT_WORD_ORDER__ __ORDER_BIG_ENDIAN__
    149#define __FLT128_HAS_DENORM__ 1
    150#define __sparc 1
    151#define __FLT128_DIG__ 33
    152#define __SCHAR_WIDTH__ 8
    153#define __INT32_C(c) c
    154#define __ORDER_PDP_ENDIAN__ 3412
    155#define sun 1
    156#define __INT_FAST32_TYPE__ int
    157#define __UINT_LEAST16_TYPE__ short unsigned int
    158#define unix 1
    159#define __SIZE_TYPE__ long unsigned int
    160#define __UINT64_MAX__ 0xffffffffffffffffUL
    161#define __FLT64X_DIG__ 33
    162#define __INT8_TYPE__ char
    163#define __ELF__ 1
    164#define __FLT_RADIX__ 2
    165#define __INT_LEAST16_TYPE__ short int
    166#define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L
    167#define __UINTMAX_C(c) c ## UL
    168#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x
    169#define __SIG_ATOMIC_MAX__ 0x7fffffff
    170#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
    171#define __SIZEOF_PTRDIFF_T__ 8
    172#define __LDBL_DIG__ 33
    173#define __FLT32X_MIN_EXP__ (-1021)
    174#define __INT_FAST16_MAX__ 0x7fffffff
    175#define __FLT64_DIG__ 15
    176#define __UINT_FAST32_MAX__ 0xffffffffU
    177#define __UINT_LEAST64_TYPE__ long unsigned int
    178#define __FLT_HAS_QUIET_NAN__ 1
    179#define __FLT_MAX_10_EXP__ 38
    180#define __LONG_MAX__ 0x7fffffffffffffffL
    181#define __FLT64X_HAS_DENORM__ 1
    182#define __FLT_HAS_INFINITY__ 1
    183#define __UINT_FAST16_TYPE__ unsigned int
    184#define __INT_FAST32_WIDTH__ 32
    185#define __CHAR16_TYPE__ short unsigned int
    186#define __PRAGMA_REDEFINE_EXTNAME 1
    187#define __SIZE_WIDTH__ 64
    188#define __INT_LEAST16_MAX__ 0x7fff
    189#define __INT64_MAX__ 0x7fffffffffffffffL
    190#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32
    191#define __SIG_ATOMIC_WIDTH__ 32
    192#define __INT_LEAST64_TYPE__ long int
    193#define __INT16_TYPE__ short int
    194#define __INT_LEAST8_TYPE__ char
    195#define __STDC_VERSION__ 201710L
    196#define __INT_FAST8_MAX__ 0x7f
    197#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128
    198#define __INTPTR_MAX__ 0x7fffffffffffffffL
    199#define __FLT64_HAS_QUIET_NAN__ 1
    200#define __FLT32_MIN_10_EXP__ (-37)
    201#define __FLT32X_DIG__ 15
    202#define __PTRDIFF_WIDTH__ 64
    203#define __LDBL_MANT_DIG__ 113
    204#define __svr4__ 1
    205#define __FLT64_HAS_INFINITY__ 1
    206#define __FLT64X_MAX__ 1.18973149535723176508575932662800702e+4932F64x
    207#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1)
    208#define __INTPTR_TYPE__ long int
    209#define __UINT16_TYPE__ short unsigned int
    210#define __WCHAR_TYPE__ int
    211#define __SIZEOF_FLOAT__ 4
    212#define __UINTPTR_MAX__ 0xffffffffffffffffUL
    213#define __INT_FAST64_WIDTH__ 64
    214#define __FLT32_DECIMAL_DIG__ 9
    215#define __INT_FAST64_MAX__ 0x7fffffffffffffffL
    216#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 255
    217#define __FLT_NORM_MAX__ 3.40282346638528859811704183484516925e+38F
    218#define __FLT32_HAS_INFINITY__ 1
    219#define __FLT64X_MAX_EXP__ 16384
    220#define __UINT_FAST64_TYPE__ long unsigned int
    221#define __INT_MAX__ 0x7fffffff
    222#define __INT64_TYPE__ long int
    223#define __FLT_MAX_EXP__ 128
    224#define __ORDER_BIG_ENDIAN__ 4321
    225#define __DBL_MANT_DIG__ 53
    226#define __INT_LEAST64_MAX__ 0x7fffffffffffffffL
    227#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
    228#define __WINT_TYPE__ int
    229#define __UINT_LEAST32_TYPE__ unsigned int
    230#define __SIZEOF_SHORT__ 2
    231#define __FLT32_NORM_MAX__ 3.40282346638528859811704183484516925e+38F32
    232#define __LDBL_MIN_EXP__ (-16381)
    233#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64
    234#define __WINT_WIDTH__ 32
    235#define __INT_LEAST8_MAX__ 0x7f
    236#define __INT_LEAST64_WIDTH__ 64
    237#define __FLT32X_MAX_10_EXP__ 308
    238#define __SIZEOF_INT128__ 16
    239#define __LDBL_MAX_10_EXP__ 4932
    240#define __ATOMIC_RELAXED 0
    241#define __DBL_EPSILON__ ((double)2.22044604925031308084726333618164062e-16L)
    242#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128
    243#define _LP64 1
    244#define __UINT8_C(c) c
    245#define __FLT64_MAX_EXP__ 1024
    246#define __INT_LEAST32_TYPE__ int
    247#define __sun__ 1
    248#define __SIZEOF_WCHAR_T__ 4
    249#define __UINT64_TYPE__ long unsigned int
    250#define __FLT64_NORM_MAX__ 1.79769313486231570814527423731704357e+308F64
    251#define __FLT128_HAS_QUIET_NAN__ 1
    252#define __INTMAX_MAX__ 0x7fffffffffffffffL
    253#define __INT_FAST8_TYPE__ char
    254#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x
    255#define __LDBL_HAS_INFINITY__ 1
    256#define __GNUC_STDC_INLINE__ 1
    257#define __FLT64_HAS_DENORM__ 1
    258#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32
    259#define __DBL_DECIMAL_DIG__ 17
    260#define __STDC_UTF_32__ 1
    261#define __INT_FAST8_WIDTH__ 8
    262#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x
    263#define __DBL_NORM_MAX__ ((double)1.79769313486231570814527423731704357e+308L)
    264#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
    265#define __INTMAX_WIDTH__ 64
    266#define __UINT32_C(c) c ## U
    267#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F
    268#define __INT8_MAX__ 0x7f
    269#define __LONG_WIDTH__ 64
    270#define __UINT_FAST32_TYPE__ unsigned int
    271#define __FLT32X_NORM_MAX__ 1.79769313486231570814527423731704357e+308F32x
    272#define __CHAR32_TYPE__ unsigned int
    273#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F
    274#define __INT32_TYPE__ int
    275#define __SIZEOF_DOUBLE__ 8
    276#define __FLT_MIN_10_EXP__ (-37)
    277#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64
    278#define __INT_LEAST32_WIDTH__ 32
    279#define __INTMAX_TYPE__ long int
    280#define __FLT32X_HAS_QUIET_NAN__ 1
    281#define __ATOMIC_CONSUME 1
    282#define __GNUC_MINOR__ 2
    283#define __INT_FAST16_WIDTH__ 32
    284#define __UINTMAX_MAX__ 0xffffffffffffffffUL
    285#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x
    286#define __DBL_MAX_10_EXP__ 308
    287#define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L
    288#define __INT16_C(c) c
    289#define __PTRDIFF_TYPE__ long int
    290#define __ATOMIC_SEQ_CST 5
    291#define __arch64__ 1
    292#define __UINT32_TYPE__ unsigned int
    293#define __FLT32X_MIN_10_EXP__ (-307)
    294#define __UINTPTR_TYPE__ long unsigned int
    295#define __LDBL_MIN_10_EXP__ (-4931)
    296#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128
    297#define __SIZEOF_LONG_LONG__ 8
    298#define __FLT128_DECIMAL_DIG__ 36
    299#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
    300#define __FLT_DECIMAL_DIG__ 9
    301#define __UINT_FAST16_MAX__ 0xffffffffU
    302#define __LDBL_NORM_MAX__ 1.18973149535723176508575932662800702e+4932L
    303#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
    304#define __UINT_FAST8_TYPE__ unsigned char
    305#define __ATOMIC_ACQ_REL 4
    306#define __ATOMIC_RELEASE 3
    
  5. tankf33der commented at 5:44 am on February 26, 2022: none

    Can you try compiling with -DSECP256K1_BIG_ENDIAN, since apparently the autodetection based on macros doesn’t work?

    Helped to compile, tests passed.

     0$ gmake check
     1gmake  check-am
     2gmake[1]: Entering directory '/export/home/mihailp/secp256k1-master'
     3gmake  check-TESTS
     4gmake[2]: Entering directory '/export/home/mihailp/secp256k1-master'
     5gmake[3]: Entering directory '/export/home/mihailp/secp256k1-master'
     6PASS: tests
     7PASS: exhaustive_tests
     8============================================================================
     9Testsuite summary for libsecp256k1 0.1.0-pre
    10============================================================================
    11# TOTAL: 2
    12# PASS:  2
    13# SKIP:  0
    14# XFAIL: 0
    15# FAIL:  0
    16# XPASS: 0
    17# ERROR: 0
    18============================================================================
    19gmake[3]: Leaving directory '/export/home/mihailp/secp256k1-master'
    20gmake[2]: Leaving directory '/export/home/mihailp/secp256k1-master'
    21gmake[1]: Leaving directory '/export/home/mihailp/secp256k1-master'
    
  6. real-or-random commented at 10:24 am on February 26, 2022: contributor

    Thanks for the quick reply. The output does not include _BIG_ENDIAN, so this is probably defined somewhere else.


    So the following two are not equivalent if FOO is defined but empty:

    0#if defined(FOO)
    1#if FOO = 1
    2...
    3#endif
    4#endif 
    
    0#if defined(FOO) && FOO == 1
    1...
    2#endif 
    

    We took the code partly from https://github.com/rofl0r/endianness.h/blob/9853923246b065a3b52d2c43835f3819a62c7199/endianness.h#L52L73 and changed it slightly. The original code checks the most commonly used macro __BYTE_ORDER__ separately and then skips all the other checks, so that would have worked here. But still, maybe the entire thing is somewhat fragile. [1] agrees with this observation and favors run-time detection, which then is again turned into compile-time detection by a clever compiler.

    The only place where we have endianness-dependant code is when reading input data for SHA256: https://github.com/bitcoin-core/secp256k1/blob/master/src/hash_impl.h#L54

    So we could:

    1. Stick to the precompiler macros and improve them. This will at least fix this issue here.
    2. Switch to runtime detection, e.g., as with a inlineable and compile-time-evalulatable function as suggested in [1]
    3. Make the code endianness-independent, preferably in a way that has in the end no overhead for LE.

    I think we should try 3 and benchmark if it really has an effect on performance. If not, we should favor that approach. It’s by far the least brittle. Otherwise 2 could be a solid option, too.

    For 1, I’m a little bit concerned by the observation in [1] that the macro approach really led to misdetection cases. We have the self-tests but they’re not always run (static context). Unfortunately there seems to be no portable C89 expression that we could use in assumptions.h (Even if compile-time constantness is not a requirement, there’s (*(uint16_t *)"\0\xff" < 0x0100) in C89 but it relies on the assumption that string literals are aligned. The other expressions I found all use C99 compound literals, e.g., see https://stackoverflow.com/a/2100549)

    [1] https://fastcompression.blogspot.com/2014/11/portability-woes-endianess-and_24.html

  7. real-or-random referenced this in commit 1f43294e53 on Mar 25, 2022
  8. real-or-random cross-referenced this on Mar 25, 2022 from issue hash: Make code agnostic of endianness by real-or-random
  9. real-or-random referenced this in commit 8d89b9e6e5 on Mar 25, 2022
  10. real-or-random closed this on Mar 28, 2022

  11. real-or-random referenced this in commit 8746600eec on Mar 28, 2022
  12. dderjoel referenced this in commit b9138ab266 on May 23, 2023
  13. matteonardelli referenced this in commit 5ac4bc757f on Jun 16, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-22 14:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me