From cdc1a1aa174b1c25084704ec6ce32046e528d5e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Ch=C3=A9ron?= Date: Fri, 15 Sep 2017 18:56:22 +0200 Subject: [PATCH] Fix link error with OpenBSD and strip --strip-unneeded Resolves #186 --- cbits/decaf/ed448goldilocks/decaf_all.c | 3 +++ cbits/decaf/tools/generate.sh | 10 ++++++++++ cryptonite.cabal | 8 ++++---- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 cbits/decaf/ed448goldilocks/decaf_all.c diff --git a/cbits/decaf/ed448goldilocks/decaf_all.c b/cbits/decaf/ed448goldilocks/decaf_all.c new file mode 100644 index 0000000..74d5f06 --- /dev/null +++ b/cbits/decaf/ed448goldilocks/decaf_all.c @@ -0,0 +1,3 @@ +/* Combined to avoid link failure on OpenBSD with --strip-unneeded, see #186 */ +#include "decaf.c" +#include "decaf_tables.c" diff --git a/cbits/decaf/tools/generate.sh b/cbits/decaf/tools/generate.sh index 3323f58..c2ef662 100755 --- a/cbits/decaf/tools/generate.sh +++ b/cbits/decaf/tools/generate.sh @@ -33,6 +33,10 @@ # * function posix_memalign is defined in order to avoid a warning on # Windows/MinGW. Hopefully it is not called. This definition is put # 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" 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/eddsa.c "$DEST_DIR"/$CURVE convert "$SRC_DIR"/GENERATED/c/$CURVE/scalar.c "$DEST_DIR"/$CURVE + + cat > "$DEST_DIR"/$CURVE/decaf_all.c <