mirror of https://github.com/bitcoin/bitcoin
pull/22585/heade4c8bb62e4
build: Fix undefined reference to __mulodi4 (Hennadii Stepanov) Pull request description: When compiling with clang on 32-bit systems the `__mulodi4` symbol is defined in compiler-rt only. Fixes #21294. See more: - https://bugs.llvm.org/show_bug.cgi?id=16404 - https://bugs.llvm.org/show_bug.cgi?id=28629 ACKs for top commit: MarcoFalke: tested-only ACKe4c8bb62e4
luke-jr: utACKe4c8bb62e4
fanquake: ACKe4c8bb62e4
- it's a bit of an awkward workaround to carry, but at-least it's contained to the fuzzers. Tree-SHA512: 93edb4ed568027702b1b9aba953ad50889b834ef97fde3cb99d1ce70076d9c00aa13f95c86b12d6f59b24fa90108d93742f920e15119901a2848fb337ab859a1
commit
d23570098c
@ -0,0 +1,42 @@
|
||||
# On some platforms clang builtin implementations
|
||||
# require compiler-rt as a runtime library to use.
|
||||
#
|
||||
# See:
|
||||
# - https://bugs.llvm.org/show_bug.cgi?id=28629
|
||||
|
||||
m4_define([_CHECK_RUNTIME_testbody], [[
|
||||
bool f(long long x, long long y, long long* p)
|
||||
{
|
||||
return __builtin_mul_overflow(x, y, p);
|
||||
}
|
||||
int main() { return 0; }
|
||||
]])
|
||||
|
||||
AC_DEFUN([CHECK_RUNTIME_LIB], [
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
|
||||
AC_MSG_CHECKING([for __builtin_mul_overflow])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_SOURCE([_CHECK_RUNTIME_testbody])],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_BUILTIN_MUL_OVERFLOW], [1], [Define if you have a working __builtin_mul_overflow])
|
||||
],
|
||||
[
|
||||
ax_check_save_flags="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS --rtlib=compiler-rt -lgcc_s"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_SOURCE([_CHECK_RUNTIME_testbody])],
|
||||
[
|
||||
AC_MSG_RESULT([yes, with additional linker flags])
|
||||
RUNTIME_LDFLAGS="--rtlib=compiler-rt -lgcc_s"
|
||||
AC_DEFINE([HAVE_BUILTIN_MUL_OVERFLOW], [1], [Define if you have a working __builtin_mul_overflow])
|
||||
],
|
||||
[AC_MSG_RESULT([no])])
|
||||
LDFLAGS="$ax_check_save_flags"
|
||||
])
|
||||
|
||||
AC_LANG_POP
|
||||
AC_SUBST([RUNTIME_LDFLAGS])
|
||||
])
|
Loading…
Reference in new issue