[PATCH 3/3] build: Disable some optimizations if TRACE_BFD is enabled

Andrei Otcheretianski andrei.otcheretianski at intel.com
Mon Jan 6 07:31:30 PST 2025


From: Benjamin Berg <benjamin.berg at intel.com>

When TRACE_BFD is enabled we need to be able to fetch stack traces.
However, some required functions might be inlined by the compiler or
hidden due to tail call optimizatons. Add -fno-inline and
-fno-optimize-sibling-calls to avoid these optimizations.

Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
---
 hostapd/Android.mk        | 2 +-
 hostapd/Makefile          | 2 +-
 wpa_supplicant/Android.mk | 2 +-
 wpa_supplicant/Makefile   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hostapd/Android.mk b/hostapd/Android.mk
index 6e0d77d28b..d097971f2d 100644
--- a/hostapd/Android.mk
+++ b/hostapd/Android.mk
@@ -127,7 +127,7 @@ HOBJS += src/utils/trace.c
 LDFLAGS += -rdynamic
 L_CFLAGS += -funwind-tables
 ifdef CONFIG_WPA_TRACE_BFD
-L_CFLAGS += -DWPA_TRACE_BFD
+L_CFLAGS += -DWPA_TRACE_BFD -fno-inline -fno-optimize-sibling-calls
 LIBS += -lbfd
 LIBS_c += -lbfd
 LIBS_h += -lbfd
diff --git a/hostapd/Makefile b/hostapd/Makefile
index 9d3ab774d2..d7688001d2 100644
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -116,7 +116,7 @@ HOBJS += ../src/utils/trace.o
 LDFLAGS += -rdynamic
 CFLAGS += -funwind-tables
 ifdef CONFIG_WPA_TRACE_BFD
-CFLAGS += -DPACKAGE="hostapd" -DWPA_TRACE_BFD
+CFLAGS += -DPACKAGE="hostapd" -DWPA_TRACE_BFD -fno-inline -fno-optimize-sibling-calls
 LIBS += -lbfd -ldl -liberty -lz
 LIBS_c += -lbfd -ldl -liberty -lz
 LIBS_h += -lbfd -ldl -liberty -lz
diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk
index 973e90dcf5..82388bc6e0 100644
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -138,7 +138,7 @@ OBJS_c += src/utils/trace.c
 LDFLAGS += -rdynamic
 L_CFLAGS += -funwind-tables
 ifdef CONFIG_WPA_TRACE_BFD
-L_CFLAGS += -DWPA_TRACE_BFD
+L_CFLAGS += -DWPA_TRACE_BFD -fno-inline -fno-optimize-sibling-calls
 LIBS += -lbfd
 LIBS_p += -lbfd
 LIBS_c += -lbfd
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index b320bf9532..391321bf0e 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -151,7 +151,7 @@ LIBCTRLSO += ../src/utils/trace.c
 LDFLAGS += -rdynamic
 CFLAGS += -funwind-tables
 ifdef CONFIG_WPA_TRACE_BFD
-CFLAGS += -DPACKAGE="wpa_supplicant" -DWPA_TRACE_BFD
+CFLAGS += -DPACKAGE="wpa_supplicant" -DWPA_TRACE_BFD -fno-inline -fno-optimize-sibling-calls
 LIBS += -lbfd -ldl -liberty -lz
 LIBS_p += -lbfd -ldl -liberty -lz
 LIBS_c += -lbfd -ldl -liberty -lz
-- 
2.43.0




More information about the Hostap mailing list