Skip to content

Commit d2eb3e5

Browse files
authored
Check asm goto support with AC_LINK_IFELSE (#13716)
The '__asm__ goto' support is properly recognized by a simpler linking check instead of a run check for easier cross-compilation. The compile only check (AC_COMPILE_IFELSE) might produce false positives results with certain compiler options.
1 parent ec394cc commit d2eb3e5

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

configure.ac

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -744,33 +744,18 @@ if test "$ac_cv_func___crc32d" = "yes"; then
744744
fi
745745

746746
dnl Check for asm goto support.
747-
AC_CACHE_CHECK([for asm goto], ac_cv__asm_goto,
748-
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
749-
int main(void) {
750-
#if defined(__x86_64__) || defined(__i386__)
751-
__asm__ goto("jmp %l0\n" :::: end);
752-
#elif defined(__aarch64__)
753-
__asm__ goto("b %l0\n" :::: end);
754-
#endif
755-
end:
756-
return 0;
757-
}
758-
]])], [ac_cv__asm_goto=yes], [ac_cv__asm_goto=no], [
759-
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
760-
int main(void) {
747+
AC_CACHE_CHECK([for asm goto], [ac_cv__asm_goto],
748+
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[
761749
#if defined(__x86_64__) || defined(__i386__)
762750
__asm__ goto("jmp %l0\n" :::: end);
763751
#elif defined(__aarch64__)
764752
__asm__ goto("b %l0\n" :::: end);
765753
#endif
766754
end:
767755
return 0;
768-
}
769-
]])], [ac_cv__asm_goto=yes], [ac_cv__asm_goto=no])
770-
])])
771-
756+
]])], [ac_cv__asm_goto=yes], [ac_cv__asm_goto=no])])
772757
if test "$ac_cv__asm_goto" = yes; then
773-
AC_DEFINE(HAVE_ASM_GOTO,1,[Define if asm goto support])
758+
AC_DEFINE([HAVE_ASM_GOTO], [1], [Define if asm goto support is available.])
774759
fi
775760

776761
dnl Check valgrind support.

0 commit comments

Comments
 (0)