Fix link error with OpenBSD and strip --strip-unneeded

Resolves #186
This commit is contained in:
Olivier Chéron 2017-09-15 18:56:22 +02:00
parent 72c3fa0f6a
commit cdc1a1aa17
3 changed files with 17 additions and 4 deletions

View File

@ -0,0 +1,3 @@
/* Combined to avoid link failure on OpenBSD with --strip-unneeded, see #186 */
#include "decaf.c"
#include "decaf_tables.c"

View File

@ -33,6 +33,10 @@
# * function posix_memalign is defined in order to avoid a warning on # * function posix_memalign is defined in order to avoid a warning on
# Windows/MinGW. Hopefully it is not called. This definition is put # Windows/MinGW. Hopefully it is not called. This definition is put
# inside portable_endian.h because this file is already included. # inside portable_endian.h because this file is already included.
#
# * files decaf.c and decaf_tables.c are compiled to a single object file
# decaf_all.o to avoid link failure on OpenBSD with --strip-unneeded
# and old versions of binutils (see #186)
SRC_DIR="$1/src" SRC_DIR="$1/src"
DEST_DIR="`dirname "$0"`"/.. DEST_DIR="`dirname "$0"`"/..
@ -90,6 +94,12 @@ for CURVE in ed448goldilocks; do
convert "$SRC_DIR"/GENERATED/c/$CURVE/decaf_tables.c "$DEST_DIR"/$CURVE convert "$SRC_DIR"/GENERATED/c/$CURVE/decaf_tables.c "$DEST_DIR"/$CURVE
convert "$SRC_DIR"/GENERATED/c/$CURVE/eddsa.c "$DEST_DIR"/$CURVE convert "$SRC_DIR"/GENERATED/c/$CURVE/eddsa.c "$DEST_DIR"/$CURVE
convert "$SRC_DIR"/GENERATED/c/$CURVE/scalar.c "$DEST_DIR"/$CURVE convert "$SRC_DIR"/GENERATED/c/$CURVE/scalar.c "$DEST_DIR"/$CURVE
cat > "$DEST_DIR"/$CURVE/decaf_all.c <<EOF
/* Combined to avoid link failure on OpenBSD with --strip-unneeded, see #186 */
#include "decaf.c"
#include "decaf_tables.c"
EOF
done done
for FIELD in p448; do for FIELD in p448; do

View File

@ -48,6 +48,8 @@ extra-source-files: cbits/*.h
cbits/decaf/p448/arch_32/*.h cbits/decaf/p448/arch_32/*.h
cbits/decaf/p448/arch_ref64/*.h cbits/decaf/p448/arch_ref64/*.h
cbits/decaf/p448/*.h cbits/decaf/p448/*.h
cbits/decaf/ed448goldilocks/decaf_tables.c
cbits/decaf/ed448goldilocks/decaf.c
cbits/p256/*.h cbits/p256/*.h
cbits/blake2/ref/*.h cbits/blake2/ref/*.h
cbits/blake2/sse/*.h cbits/blake2/sse/*.h
@ -270,8 +272,7 @@ Library
, cbits/decaf/p448/f_arithmetic.c , cbits/decaf/p448/f_arithmetic.c
, cbits/decaf/utils.c , cbits/decaf/utils.c
, cbits/decaf/ed448goldilocks/scalar.c , cbits/decaf/ed448goldilocks/scalar.c
, cbits/decaf/ed448goldilocks/decaf_tables.c , cbits/decaf/ed448goldilocks/decaf_all.c
, cbits/decaf/ed448goldilocks/decaf.c
, cbits/decaf/ed448goldilocks/eddsa.c , cbits/decaf/ed448goldilocks/eddsa.c
include-dirs: cbits/decaf/include/arch_ref64 include-dirs: cbits/decaf/include/arch_ref64
@ -282,8 +283,7 @@ Library
, cbits/decaf/p448/f_arithmetic.c , cbits/decaf/p448/f_arithmetic.c
, cbits/decaf/utils.c , cbits/decaf/utils.c
, cbits/decaf/ed448goldilocks/scalar.c , cbits/decaf/ed448goldilocks/scalar.c
, cbits/decaf/ed448goldilocks/decaf_tables.c , cbits/decaf/ed448goldilocks/decaf_all.c
, cbits/decaf/ed448goldilocks/decaf.c
, cbits/decaf/ed448goldilocks/eddsa.c , cbits/decaf/ed448goldilocks/eddsa.c
include-dirs: cbits/decaf/include/arch_32 include-dirs: cbits/decaf/include/arch_32