From e34a1746b013695c66456b88b5ae822012f81408 Mon Sep 17 00:00:00 2001 From: Alexey Sheplyakov Date: Tue, 6 Jun 2023 13:29:54 +0000 Subject: [PATCH] Fixed i386 misdetection on non-x86 architectures libtool: compile: loongarch64-alt-linux-gcc -DHAVE_CONFIG_H -I. -I.. -pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto -c trace.c -fPIC -DPIC -o .libs/trace.o make[2]: Leaving directory '/usr/src/RPM/BUILD/potrace-1.16/src' make[2]: Entering directory '/usr/src/RPM/BUILD/potrace-1.16/src' /bin/sh ../libtool --tag=CC --mode=link loongarch64-alt-linux-gcc -pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto -o mkbitmap mkbitmap.o bitmap_io.o greymap.o -lm libtool: link: loongarch64-alt-linux-gcc -pipe -frecord-gcc-switches -Wall -g -O2 -flto=auto -o mkbitmap mkbitmap.o bitmap_io.o greymap.o -lm {standard input}: Assembler messages: {standard input}:3817: Error: no match insn: bsf $r12,$r14 {standard input}:3818: Error: no match insn: jnz 0f {standard input}:3819: Error: no match insn: movl $32,$r14 {standard input}:3839: Error: no match insn: bsf $r12,$r13 {standard input}:3840: Error: no match insn: jnz 0f {standard input}:3841: Error: no match insn: movl $32,$r13 {standard input}:3852: Error: no match insn: bsf $r12,$r12 {standard input}:3853: Error: no match insn: jnz 0f {standard input}:3854: Error: no match insn: movl $32,$r12 make[3]: *** [/usr/src/tmp/cckhtRVf.mk:2: /usr/src/tmp/ccI17jqP.ltrans0.ltrans.o] Error 1 lto-wrapper: fatal error: make returned 2 exit status compilation terminated. ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status To solve the problem avoid the UB in the test program which checks if x86 asm can be used. Closes: #46405 --- potrace/configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/potrace/configure.ac b/potrace/configure.ac index 26cfc91..4f97696 100644 --- a/potrace/configure.ac +++ b/potrace/configure.ac @@ -251,7 +251,7 @@ AC_CHECK_FUNC(strncasecmp, , dnl ---------------------------------------------------------------------- dnl Check whether we have i386 features AC_MSG_CHECKING([for Intel 386]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int x; +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int x=1; asm("bsf %1,%0\njnz 0f\nmovl $32,%0\n0:":"=r"(x):"r"(x)); return x; /* need this so that -O2 does not optimize the asm away */ ]])],[AC_MSG_RESULT(yes) -- 2.33.3