Skip to content

Commit ceda0a5

Browse files
committed
build: Use secp objects directly when linking
For straight libwallycore.so builds, this avoids issues with adding ar files containing universal binaries to an existing ar file, which current tooling does not support.
1 parent 1eb66b5 commit ceda0a5

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

configure.ac

-29
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,6 @@ AC_SUBST([NOOPT_CFLAGS])
171171
AC_SUBST([NOALIAS_CFLAGS])
172172
AC_SUBST([NOBUILTIN_CFLAGS])
173173

174-
# Under OSX the compiler accepts this flag but the linker then fails.
175-
if test "x$is_osx" != "xyes"; then
176-
AX_CHECK_COMPILE_FLAG([-Wl,--whole-archive], [whole_archive=yes])
177-
fi
178-
179174
# SWIG versions vary in generated code quality; skip warnings
180175
SWIG_WARN_CFLAGS="-fno-strict-aliasing"
181176
AX_CHECK_COMPILE_FLAG([-Wno-shadow], [SWIG_WARN_CFLAGS="$SWIG_WARN_CFLAGS -Wno-shadow"])
@@ -236,30 +231,6 @@ if test "x$ac_have_pthread" == "xyes"; then
236231
AC_CHECK_HEADERS([asm/page.h])
237232
fi
238233

239-
#
240-
# libsecp256k1
241-
#
242-
# FIXME: This is needed to force libtool to use all object files from secp.
243-
# We can only build secp properly by recursively invoking
244-
# configure/make, and can't include it as a noinst_ library. Libtool
245-
# assumes that such libraries will be installed along with our library
246-
# target and so won't force all object files in the library to be
247-
# included in ours - despite the fact that we are making a shared
248-
# library and linking to a static one. This is broken and we work
249-
# around it by hacking the whole-archive flags into the _LDADD variable
250-
# for wallycore.
251-
# Because automake tries to police its users very strictly and fails
252-
# hard when flags are passed in this way, we have to substitute the
253-
# flags here.
254-
# Because libtool both intercepts -Wl and arbitrarily re-orders its
255-
# command line inputs, we have to concoct a single expression to
256-
# enforce linking that cannot be split, hence the below expression.
257-
LIBADD_SECP256K1="secp256k1/.libs/libsecp256k1.a"
258-
if test "x$whole_archive" == "xyes"; then
259-
LIBADD_SECP256K1="-Wl,--whole-archive,secp256k1/.libs/libsecp256k1.a,--no-whole-archive"
260-
fi
261-
AC_SUBST([LIBADD_SECP256K1])
262-
263234
#
264235
# Python facilities
265236
#

src/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ endif
236236
endif # SHARED_BUILD_ENABLED
237237

238238
libwallycore_la_CFLAGS = -I$(top_srcdir) -I$(srcdir)/ccan -DWALLY_CORE_BUILD=1 $(AM_CFLAGS)
239-
libwallycore_la_LIBADD = $(LIBADD_SECP256K1) $(noinst_LTLIBRARIES)
239+
libwallycore_la_LIBADD = secp256k1/src/libsecp256k1_la-secp256k1.o secp256k1/src/libsecp256k1_precomputed_la-precomputed_ecmult_gen.o secp256k1/src/libsecp256k1_precomputed_la-precomputed_ecmult.o $(noinst_LTLIBRARIES)
240240

241241
SUBDIRS = secp256k1
242242

0 commit comments

Comments
 (0)