* [PATCH net-next] sh: add missing fpscr_values
@ 2014-04-02 2:54 Alexei Starovoitov
2014-04-02 7:04 ` Daniel Borkmann
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Alexei Starovoitov @ 2014-04-02 2:54 UTC (permalink / raw)
To: David S. Miller
Cc: Nobuhiro Iwamatsu, Daniel Borkmann, Paul Mundt, Fengguang Wu,
linux-sh, netdev
GCC on SuperH for the following program:
int foo(int i)
{
static const void *table[2] = {
[0] = &&label1,
[1] = &&label2,
};
goto *table[i & 1];
label1:
return 1;
label2:
return 2;
}
generates code:
mov.l .L9,r1
mov #1,r0
rts
lds.l @r1+,fpscr
.L9:
.long __fpscr_values+4
so kernel has to provide body of fpscr_values just like glibc does
Fixes: bd4cf0ed331a ("net: filter: rework/optimize internal BPF interpreter's instruction set")
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Cc: Daniel Borkmann <dborkman@redhat.com>
---
kernel modules can hit the same problem, so export it
arch/sh/lib/Makefile | 2 +-
arch/sh/lib/fpscr_values.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
create mode 100644 arch/sh/lib/fpscr_values.c
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index 3baff31e58cf..0d0c7ae21cfe 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -8,7 +8,7 @@ lib-y = delay.o memmove.o memchr.o \
# Extracted from libgcc
obj-y += movmem.o ashldi3.o ashrdi3.o lshrdi3.o \
ashlsi3.o ashrsi3.o ashiftrt.o lshrsi3.o \
- udiv_qrnnd.o
+ udiv_qrnnd.o fpscr_values.o
udivsi3-y := udivsi3_i4i-Os.o
diff --git a/arch/sh/lib/fpscr_values.c b/arch/sh/lib/fpscr_values.c
new file mode 100644
index 000000000000..58153272aba1
--- /dev/null
+++ b/arch/sh/lib/fpscr_values.c
@@ -0,0 +1,4 @@
+#include <linux/module.h>
+
+long __fpscr_values[2] = { 0L, 0x80000L };
+EXPORT_SYMBOL(__fpscr_values);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH net-next] sh: add missing fpscr_values 2014-04-02 2:54 [PATCH net-next] sh: add missing fpscr_values Alexei Starovoitov @ 2014-04-02 7:04 ` Daniel Borkmann 2014-04-02 7:38 ` Geert Uytterhoeven 2014-04-02 12:47 ` David Miller 2 siblings, 0 replies; 6+ messages in thread From: Daniel Borkmann @ 2014-04-02 7:04 UTC (permalink / raw) To: Alexei Starovoitov Cc: David S. Miller, Nobuhiro Iwamatsu, Paul Mundt, Fengguang Wu, linux-sh, netdev On 04/02/2014 04:54 AM, Alexei Starovoitov wrote: > GCC on SuperH for the following program: > int foo(int i) > { > static const void *table[2] = { > [0] = &&label1, > [1] = &&label2, > }; > goto *table[i & 1]; > > label1: > return 1; > label2: > return 2; > } > generates code: > mov.l .L9,r1 > mov #1,r0 > rts > lds.l @r1+,fpscr > .L9: > .long __fpscr_values+4 > > so kernel has to provide body of fpscr_values just like glibc does > > Fixes: bd4cf0ed331a ("net: filter: rework/optimize internal BPF interpreter's instruction set") > Reported-by: Fengguang Wu <fengguang.wu@intel.com> > Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> > Cc: Daniel Borkmann <dborkman@redhat.com> Acked-by: Daniel Borkmann <dborkman@redhat.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] sh: add missing fpscr_values 2014-04-02 2:54 [PATCH net-next] sh: add missing fpscr_values Alexei Starovoitov 2014-04-02 7:04 ` Daniel Borkmann @ 2014-04-02 7:38 ` Geert Uytterhoeven 2014-04-02 10:52 ` Geert Uytterhoeven 2014-04-02 12:47 ` David Miller 2 siblings, 1 reply; 6+ messages in thread From: Geert Uytterhoeven @ 2014-04-02 7:38 UTC (permalink / raw) To: Alexei Starovoitov Cc: David S. Miller, Nobuhiro Iwamatsu, Daniel Borkmann, Paul Mundt, Fengguang Wu, Linux-sh list, netdev@vger.kernel.org On Wed, Apr 2, 2014 at 4:54 AM, Alexei Starovoitov <ast@plumgrid.com> wrote: > GCC on SuperH for the following program: > int foo(int i) > { > static const void *table[2] = { > [0] = &&label1, > [1] = &&label2, > }; > goto *table[i & 1]; > > label1: > return 1; > label2: > return 2; > } > generates code: > mov.l .L9,r1 > mov #1,r0 > rts > lds.l @r1+,fpscr > .L9: > .long __fpscr_values+4 > > so kernel has to provide body of fpscr_values just like glibc does > > Fixes: bd4cf0ed331a ("net: filter: rework/optimize internal BPF interpreter's instruction set") > Reported-by: Fengguang Wu <fengguang.wu@intel.com> > Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> > Cc: Daniel Borkmann <dborkman@redhat.com> > --- > > kernel modules can hit the same problem, so export it > > arch/sh/lib/Makefile | 2 +- > arch/sh/lib/fpscr_values.c | 4 ++++ > 2 files changed, 5 insertions(+), 1 deletion(-) > create mode 100644 arch/sh/lib/fpscr_values.c > > diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile > index 3baff31e58cf..0d0c7ae21cfe 100644 > --- a/arch/sh/lib/Makefile > +++ b/arch/sh/lib/Makefile > @@ -8,7 +8,7 @@ lib-y = delay.o memmove.o memchr.o \ > # Extracted from libgcc > obj-y += movmem.o ashldi3.o ashrdi3.o lshrdi3.o \ > ashlsi3.o ashrsi3.o ashiftrt.o lshrsi3.o \ > - udiv_qrnnd.o > + udiv_qrnnd.o fpscr_values.o > > udivsi3-y := udivsi3_i4i-Os.o > > diff --git a/arch/sh/lib/fpscr_values.c b/arch/sh/lib/fpscr_values.c > new file mode 100644 > index 000000000000..58153272aba1 > --- /dev/null > +++ b/arch/sh/lib/fpscr_values.c > @@ -0,0 +1,4 @@ > +#include <linux/module.h> > + > +long __fpscr_values[2] = { 0L, 0x80000L }; > +EXPORT_SYMBOL(__fpscr_values); Pardon my ignorance, but according to http://www.sourceware.org/ml/libc-alpha/2003-06/msg00027.html __fpscr_values is needed for FPU support only. The kernel is built with -m4-nofpu. If this option is used, gcc doesn't generate the reference to __fpscr_values? Why do we need symbols for userspace FPU support in the kernel? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] sh: add missing fpscr_values 2014-04-02 7:38 ` Geert Uytterhoeven @ 2014-04-02 10:52 ` Geert Uytterhoeven 0 siblings, 0 replies; 6+ messages in thread From: Geert Uytterhoeven @ 2014-04-02 10:52 UTC (permalink / raw) To: Alexei Starovoitov Cc: David S. Miller, Nobuhiro Iwamatsu, Daniel Borkmann, Paul Mundt, Fengguang Wu, Linux-sh list, netdev@vger.kernel.org, Linux-Next On Wed, Apr 2, 2014 at 9:38 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Wed, Apr 2, 2014 at 4:54 AM, Alexei Starovoitov <ast@plumgrid.com> wrote: >> GCC on SuperH for the following program: >> int foo(int i) >> { >> static const void *table[2] = { >> [0] = &&label1, >> [1] = &&label2, >> }; >> goto *table[i & 1]; >> >> label1: >> return 1; >> label2: >> return 2; >> } >> generates code: >> mov.l .L9,r1 >> mov #1,r0 >> rts >> lds.l @r1+,fpscr >> .L9: >> .long __fpscr_values+4 >> >> so kernel has to provide body of fpscr_values just like glibc does >> >> Fixes: bd4cf0ed331a ("net: filter: rework/optimize internal BPF interpreter's instruction set") >> Reported-by: Fengguang Wu <fengguang.wu@intel.com> >> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> >> Cc: Daniel Borkmann <dborkman@redhat.com> >> --- >> >> kernel modules can hit the same problem, so export it >> >> arch/sh/lib/Makefile | 2 +- >> arch/sh/lib/fpscr_values.c | 4 ++++ >> 2 files changed, 5 insertions(+), 1 deletion(-) >> create mode 100644 arch/sh/lib/fpscr_values.c >> >> diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile >> index 3baff31e58cf..0d0c7ae21cfe 100644 >> --- a/arch/sh/lib/Makefile >> +++ b/arch/sh/lib/Makefile >> @@ -8,7 +8,7 @@ lib-y = delay.o memmove.o memchr.o \ >> # Extracted from libgcc >> obj-y += movmem.o ashldi3.o ashrdi3.o lshrdi3.o \ >> ashlsi3.o ashrsi3.o ashiftrt.o lshrsi3.o \ >> - udiv_qrnnd.o >> + udiv_qrnnd.o fpscr_values.o >> >> udivsi3-y := udivsi3_i4i-Os.o >> >> diff --git a/arch/sh/lib/fpscr_values.c b/arch/sh/lib/fpscr_values.c >> new file mode 100644 >> index 000000000000..58153272aba1 >> --- /dev/null >> +++ b/arch/sh/lib/fpscr_values.c >> @@ -0,0 +1,4 @@ >> +#include <linux/module.h> >> + >> +long __fpscr_values[2] = { 0L, 0x80000L }; >> +EXPORT_SYMBOL(__fpscr_values); > > Pardon my ignorance, but according to > http://www.sourceware.org/ml/libc-alpha/2003-06/msg00027.html > __fpscr_values is needed for FPU support only. > > The kernel is built with -m4-nofpu. If this option is used, gcc doesn't generate > the reference to __fpscr_values? > > Why do we need symbols for userspace FPU support in the kernel? Ah, so this comes from these build failures in -next: http://kisskb.ellerman.id.au/kisskb/buildresult/10875446/ http://kisskb.ellerman.id.au/kisskb/buildresult/10875446/ Indeed, SH2A-targets fail when built with a sh4-linux toolchain, as sh4-linux-gcc doesn't understand -m2a-nofpu, so it's left out: arch/sh/Makefile: cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \ $(call cc-option,-m2a-nofpu,) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] sh: add missing fpscr_values 2014-04-02 2:54 [PATCH net-next] sh: add missing fpscr_values Alexei Starovoitov 2014-04-02 7:04 ` Daniel Borkmann 2014-04-02 7:38 ` Geert Uytterhoeven @ 2014-04-02 12:47 ` David Miller 2014-04-02 16:09 ` Alexei Starovoitov 2 siblings, 1 reply; 6+ messages in thread From: David Miller @ 2014-04-02 12:47 UTC (permalink / raw) To: ast; +Cc: nobuhiro.iwamatsu.yj, dborkman, lethal, fengguang.wu, linux-sh, netdev From: Alexei Starovoitov <ast@plumgrid.com> Date: Tue, 1 Apr 2014 19:54:04 -0700 > GCC on SuperH for the following program: > int foo(int i) > { > static const void *table[2] = { > [0] = &&label1, > [1] = &&label2, > }; > goto *table[i & 1]; > > label1: > return 1; > label2: > return 2; > } > generates code: > mov.l .L9,r1 > mov #1,r0 > rts > lds.l @r1+,fpscr > .L9: > .long __fpscr_values+4 > > so kernel has to provide body of fpscr_values just like glibc does > > Fixes: bd4cf0ed331a ("net: filter: rework/optimize internal BPF interpreter's instruction set") > Reported-by: Fengguang Wu <fengguang.wu@intel.com> > Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> You guys really need to just fix the compiler, sorry. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] sh: add missing fpscr_values 2014-04-02 12:47 ` David Miller @ 2014-04-02 16:09 ` Alexei Starovoitov 0 siblings, 0 replies; 6+ messages in thread From: Alexei Starovoitov @ 2014-04-02 16:09 UTC (permalink / raw) To: David Miller Cc: Nobuhiro Iwamatsu, Daniel Borkmann, Paul Mundt, kbuild test robot, linux-sh, Network Development, Kaz Kojima, Geert Uytterhoeven, linux-next On Wed, Apr 2, 2014 at 5:47 AM, David Miller <davem@davemloft.net> wrote: > From: Alexei Starovoitov <ast@plumgrid.com> > Date: Tue, 1 Apr 2014 19:54:04 -0700 > >> GCC on SuperH for the following program: >> int foo(int i) >> { >> static const void *table[2] = { >> [0] = &&label1, >> [1] = &&label2, >> }; >> goto *table[i & 1]; >> >> label1: >> return 1; >> label2: >> return 2; >> } >> generates code: >> mov.l .L9,r1 >> mov #1,r0 >> rts >> lds.l @r1+,fpscr >> .L9: >> .long __fpscr_values+4 >> >> so kernel has to provide body of fpscr_values just like glibc does >> >> Fixes: bd4cf0ed331a ("net: filter: rework/optimize internal BPF interpreter's instruction set") >> Reported-by: Fengguang Wu <fengguang.wu@intel.com> >> Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> > > You guys really need to just fix the compiler, sorry. agree. To summarize: according to Kaz: "For sh2a, configuring gcc with --with-multilib-list=m2a,m2a-nofpu and specifying -m2a-nofpu during compiling kernel would work." and as Geert pointed out we already have: arch/sh/Makefile: cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \ $(call cc-option,-m2a-nofpu,) so no kernel changes needed and gcc just needs to be reconfigured. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-04-02 16:09 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-04-02 2:54 [PATCH net-next] sh: add missing fpscr_values Alexei Starovoitov 2014-04-02 7:04 ` Daniel Borkmann 2014-04-02 7:38 ` Geert Uytterhoeven 2014-04-02 10:52 ` Geert Uytterhoeven 2014-04-02 12:47 ` David Miller 2014-04-02 16:09 ` Alexei Starovoitov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).