Bug#565369: eglibc: Please add __set_fpscr prototype

2010-01-15 Thread Thomas Schwinge
Hello!

FYI: This has been submitted upstream already (but not yet applied, I
think): http://sourceware.org/ml/libc-alpha/2009-12/msg7.html


Regards,
 Thomas


signature.asc
Description: Digital signature


Bug#565369: eglibc: Please add __set_fpscr prototype

2010-01-15 Thread Nobuhiro Iwamatsu
Hi, Thomas.

2010/1/15 Thomas Schwinge tho...@schwinge.name:


 FYI: This has been submitted upstream already (but not yet applied, I
 think): http://sourceware.org/ml/libc-alpha/2009-12/msg7.html



I didnt check ML of glibc-alpha. Thank you.
I confirmed that Upstream didn’t yet apply it.
# Gentoo already applied this patch to glibc. (Patch submitter is
Gentoo Developer.)
But this patch is not enough. We cannot use _FPU_SETCW in C++ on SH.
I will confirm this in upstream.

Best regards,
  Nobuhiro

-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6



--
To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#565369: eglibc: Please add __set_fpscr prototype

2010-01-14 Thread Nobuhiro Iwamatsu
Source: eglibc
Version: 2.10.2-5
Severity: important
Tags: patch
User: debian-...@superh.org
Usertags: sh4
X-Debbugs-CC: debian-sup...@lists.debian.org

Hi,

When we compile a  program that used _FPU_SETCW in sh4 in C++, we
become the error.
Because .
1.Current eglibc does not have prototype of __set_fpscr.
2. _FPU_SETCW is macro, and __set_fpscr function in libgcc.a is called.
When user use _FPU_SETCW in C++, user has build error. Because
extern C is not set to  __set_fpscr.

This is sh4 specific.

test program:
-
$ cat f.c
#include fpu_control.h
int main(void)
{
_FPU_SETCW(0);
return 0;
}
-

build log: (failed)
-
$ g++ -o f f.c -Wl,-t
/usr/bin/ld: mode shlelf_linux
/usr/lib/gcc/sh4-linux-gnu/4.4.2/../../../crt1.o
/usr/lib/gcc/sh4-linux-gnu/4.4.2/../../../crti.o
/usr/lib/gcc/sh4-linux-gnu/4.4.2/crtbegin.o
/tmp/ccZX5ufD.o
-lstdc++ (/usr/lib/gcc/sh4-linux-gnu/4.4.2/libstdc++.so)
-lm (/usr/lib/gcc/sh4-linux-gnu/4.4.2/../../../libm.so)
libgcc_s.so.1 (/usr/lib/gcc/sh4-linux-gnu/4.4.2/libgcc_s.so.1)
/lib/libc.so.6
(/usr/lib/libc_nonshared.a)elf-init.oS
/lib/ld-linux.so.2
libgcc_s.so.1 (/usr/lib/gcc/sh4-linux-gnu/4.4.2/libgcc_s.so.1)
/usr/lib/gcc/sh4-linux-gnu/4.4.2/crtend.o
/usr/lib/gcc/sh4-linux-gnu/4.4.2/../../../crtn.o
/tmp/ccZX5ufD.o: In function `main':
f.c:(.text+0x24): undefined reference to `__set_fpscr(unsigned long)'
/usr/bin/ld: link errors found, deleting executable `f'
collect2: ld returned 1 exit status
-

build log: (success. After applied the patch which I attached.)
-
$ g++ -o f f.c -Wl,-t
/usr/bin/ld: mode shlelf_linux
/usr/lib/gcc/sh4-linux-gnu/4.4.2/../../../crt1.o
/usr/lib/gcc/sh4-linux-gnu/4.4.2/../../../crti.o
/usr/lib/gcc/sh4-linux-gnu/4.4.2/crtbegin.o
/tmp/ccu0OHaQ.o
-lstdc++ (/usr/lib/gcc/sh4-linux-gnu/4.4.2/libstdc++.so)
-lm (/usr/lib/gcc/sh4-linux-gnu/4.4.2/../../../libm.so)
libgcc_s.so.1 (/usr/lib/gcc/sh4-linux-gnu/4.4.2/libgcc_s.so.1)
(/usr/lib/gcc/sh4-linux-gnu/4.4.2/libgcc.a)_set_fpscr.o
/lib/libc.so.6
(/usr/lib/libc_nonshared.a)elf-init.oS
/lib/ld-linux.so.2
libgcc_s.so.1 (/usr/lib/gcc/sh4-linux-gnu/4.4.2/libgcc_s.so.1)
/usr/lib/gcc/sh4-linux-gnu/4.4.2/crtend.o
/usr/lib/gcc/sh4-linux-gnu/4.4.2/../../../crtn.o
-

I made a patch to solve this problem. Could you apply this patch?
I apply extern C to only __set_fpscr with patch. Should I apply
the whole file in this?

Best regards,
 Nobuhiro

-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6
--- a/sysdeps/sh/sh4/fpu/fpu_control.h  2006-08-17 10:18:26.0 +0900
+++ b/sysdeps/sh/sh4/fpu/fpu_control.h  2010-01-15 15:31:04.0 +0900
@@ -45,6 +45,14 @@
 #define _FPU_GETCW(cw) __asm__ (sts fpscr,%0 : =r (cw))
 
 #if defined __GNUC__
+/* Allow the use in C++ code.  */
+#ifdef __cplusplus
+extern C {
+#endif
+extern void __set_fpscr(unsigned long);
+#ifdef __cplusplus
+}
+#endif  /* C++ */
 #define _FPU_SETCW(cw) __set_fpscr ((cw))
 #else
 #define _FPU_SETCW(cw) __asm__ (lds %0,fpscr : : r (cw))