Michael Büsch
2014-10-05 11:06:22 UTC
Building linuxcnc 2.6 (git) with gcc 4.7.x on recent Debian x86_64 results
in unresolved 'sincos' symbol in various kernel modules.
The compiler replaces consecutive sin/cos calls by sincos calls automagically.
This patch adds -fno-builtin-sincos -fno-builtin-sin -fno-builtin-cos to
discourage the compiler from replacing sin/cos calls.
Signed-off-by: Michael Buesch <***@bues.ch>
---
Adding EXPORT_SYMBOL to the sincos from posemath does not solve the issue.
It results in a kernel panic, when the sincos is called.
I guess there's a difference in the call ABI.
I did not investigate on this further. I think we should add explicit sincos calls
where appropriate, if we want them.
Index: src/Makefile
===================================================================
--- src.orig/Makefile 2014-10-04 16:04:37.233794613 +0200
+++ src/Makefile 2014-10-04 16:06:17.214484287 +0200
@@ -740,7 +740,7 @@
-I$(BASEPWD)/libnml/posemath -I$(BASEPWD)/rtapi -I$(BASEPWD)/hal \
-I$(BASEPWD)/emc/nml_intf -I$(BASEPWD)/emc/kinematics -I$(BASEPWD)/emc/motion \
-DSEQUENTIAL_SUPPORT -DHAL_SUPPORT -DDYNAMIC_PLCSIZE -DRT_SUPPORT -DOLD_TIMERS_MONOS_SUPPORT -DMODBUS_IO_MASTER \
- -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations \
+ -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations -fno-builtin-sincos -fno-builtin-sin -fno-builtin-cos \
$(call cc-option,-Wframe-larger-than=2560) $(call cc-option,-Wno-declaration-after-statement) \
$(INTEGER_OVERFLOW_FLAGS)
ifneq ($(KERNELRELEASE),)
Index: src/Makefile.modinc.in
===================================================================
--- src.orig/Makefile.modinc.in 2014-10-04 16:04:37.233794613 +0200
+++ src/Makefile.modinc.in 2014-10-04 16:06:17.214484287 +0200
@@ -62,7 +62,7 @@
KERNELDIR := @KERNELDIR@
CC := @CC@
RTAI = @RTAI@
-RTFLAGS = $(filter-out -ffast-math,@RTFLAGS@ @EXT_RTFLAGS@) -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations
+RTFLAGS = $(filter-out -ffast-math,@RTFLAGS@ @EXT_RTFLAGS@) -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations -fno-builtin-sincos -fno-builtin-sin -fno-builtin-cos
RTFLAGS := -Os -g -I. -***@RTDIR@/include $(RTFLAGS) -DRTAPI -D_GNU_SOURCE -Drealtime
ifneq ($(KERNELRELEASE),)
ifeq ($(RTARCH):$(RTAI):$(filter $(RTFLAGS),-msse),x86_64:3:)
in unresolved 'sincos' symbol in various kernel modules.
The compiler replaces consecutive sin/cos calls by sincos calls automagically.
This patch adds -fno-builtin-sincos -fno-builtin-sin -fno-builtin-cos to
discourage the compiler from replacing sin/cos calls.
Signed-off-by: Michael Buesch <***@bues.ch>
---
Adding EXPORT_SYMBOL to the sincos from posemath does not solve the issue.
It results in a kernel panic, when the sincos is called.
I guess there's a difference in the call ABI.
I did not investigate on this further. I think we should add explicit sincos calls
where appropriate, if we want them.
Index: src/Makefile
===================================================================
--- src.orig/Makefile 2014-10-04 16:04:37.233794613 +0200
+++ src/Makefile 2014-10-04 16:06:17.214484287 +0200
@@ -740,7 +740,7 @@
-I$(BASEPWD)/libnml/posemath -I$(BASEPWD)/rtapi -I$(BASEPWD)/hal \
-I$(BASEPWD)/emc/nml_intf -I$(BASEPWD)/emc/kinematics -I$(BASEPWD)/emc/motion \
-DSEQUENTIAL_SUPPORT -DHAL_SUPPORT -DDYNAMIC_PLCSIZE -DRT_SUPPORT -DOLD_TIMERS_MONOS_SUPPORT -DMODBUS_IO_MASTER \
- -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations \
+ -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations -fno-builtin-sincos -fno-builtin-sin -fno-builtin-cos \
$(call cc-option,-Wframe-larger-than=2560) $(call cc-option,-Wno-declaration-after-statement) \
$(INTEGER_OVERFLOW_FLAGS)
ifneq ($(KERNELRELEASE),)
Index: src/Makefile.modinc.in
===================================================================
--- src.orig/Makefile.modinc.in 2014-10-04 16:04:37.233794613 +0200
+++ src/Makefile.modinc.in 2014-10-04 16:06:17.214484287 +0200
@@ -62,7 +62,7 @@
KERNELDIR := @KERNELDIR@
CC := @CC@
RTAI = @RTAI@
-RTFLAGS = $(filter-out -ffast-math,@RTFLAGS@ @EXT_RTFLAGS@) -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations
+RTFLAGS = $(filter-out -ffast-math,@RTFLAGS@ @EXT_RTFLAGS@) -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations -fno-builtin-sincos -fno-builtin-sin -fno-builtin-cos
RTFLAGS := -Os -g -I. -***@RTDIR@/include $(RTFLAGS) -DRTAPI -D_GNU_SOURCE -Drealtime
ifneq ($(KERNELRELEASE),)
ifeq ($(RTARCH):$(RTAI):$(filter $(RTFLAGS),-msse),x86_64:3:)
--
Michael
Michael