[OpenWrt-Devel] [PATCH] wolfssl: use -fomit-frame-pointer to fix asm error

Eneas U de Queiroz cotequeiroz at gmail.com
Tue May 26 09:45:22 EDT 2020

32-bit x86 fail to compile fast-math feature when compiled with frame
pointer, which uses a register used in a couple of inline asm functions.

Previous versions of wolfssl had this by default.  Keeping an extra
register available may increase performance, so it's being restored for
all architectures.

Signed-off-by: Eneas U de Queiroz <cotequeiroz at gmail.com>

i386 builds currently fail with:
./wolfcrypt/src/asm.c:700:1: error: 'asm' operand has impossible constraints

This is because wolfssl uses all of the available register for [at
least] a couple of its fast-math inline asm functions.  The
frame-pointer uses up one of them causing the above failure.

gcc documentation indicates that -fomit-frame-pointer is used in -O1, so
it should be enabled without the flag, but this compile error indicates
otherwise.  I'm not experienced enough to know why this is happening.

There are other alternatives:
 - use -fomit-frame-pointer only for i386
 - disable asm for i386
 - disable fast-math for i386
 - patch asm.c to loosen the constraint of one of the arguments from r=
   to g= in the affected functions

The last 3 are there for completeness, I'm not really considering them.


diff --git a/package/libs/wolfssl/Makefile b/package/libs/wolfssl/Makefile
index b186a087e7..159cfbc53f 100644
--- a/package/libs/wolfssl/Makefile
+++ b/package/libs/wolfssl/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
@@ -56,7 +56,7 @@ define Package/libwolfssl/config
 	source "$(SOURCE)/Config.in"
+TARGET_CFLAGS += $(FPIC) -DFP_MAX_BITS=8192 -fomit-frame-pointer
 # --enable-stunnel needed for OpenSSL API compatibility bits

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list