This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Fix mips16 __fpu_control static linking (bug 18397) [committed]
- From: Joseph Myers <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Mon, 11 May 2015 23:00:21 +0000
- Subject: Fix mips16 __fpu_control static linking (bug 18397) [committed]
- Authentication-results: sourceware.org; auth=none
Programs are supposed to be able to define the __fpu_control variable,
overriding the library's version to cause the floating-point control
word to be set to the chosen value at startup.
This is broken for mips16 for static linking because the library's
__fpu_control variable is in the same object file as the helper
functions used by fpu_control.h for mips16, so test-fpucw-ieee-static
fails to link with multiple definitions of __fpu_control.
This patch fixes this by putting the helpers in a separate file rather
than overriding fpu_control.c. Tested for mips16 that this fixes the
link failure and the ABI tests still pass. Committed.
2015-05-11 Joseph Myers <joseph@codesourcery.com>
[BZ #18397]
* sysdeps/mips/mips32/fpu/fpu_control.c: Move to ....
* sysdeps/mips/mips32/fpu/fpucw-helpers.c: ... here. Include
<fpu_control.h> instead of <math/fpu_control.c>.
* sysdeps/mips/mips32/fpu/Makefile: New file.
diff --git a/sysdeps/mips/mips32/fpu/Makefile b/sysdeps/mips/mips32/fpu/Makefile
new file mode 100644
index 0000000..951c408
--- /dev/null
+++ b/sysdeps/mips/mips32/fpu/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),math)
+aux += fpucw-helpers
+endif
diff --git a/sysdeps/mips/mips32/fpu/fpu_control.c b/sysdeps/mips/mips32/fpu/fpu_control.c
deleted file mode 100644
index eeb94c5..0000000
--- a/sysdeps/mips/mips32/fpu/fpu_control.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* FPU control word handling, MIPS version, needed by MIPS16 callers.
- Copyright (C) 1996-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <math/fpu_control.c>
-
-fpu_control_t
-__mips_fpu_getcw (void)
-{
- fpu_control_t cw;
-
- _FPU_GETCW (cw);
- return cw;
-}
-
-void
-__mips_fpu_setcw (fpu_control_t cw)
-{
- _FPU_SETCW (cw);
-}
diff --git a/sysdeps/mips/mips32/fpu/fpucw-helpers.c b/sysdeps/mips/mips32/fpu/fpucw-helpers.c
new file mode 100644
index 0000000..40391a3
--- /dev/null
+++ b/sysdeps/mips/mips32/fpu/fpucw-helpers.c
@@ -0,0 +1,34 @@
+/* FPU control word handling, MIPS version, needed by MIPS16 callers.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fpu_control.h>
+
+fpu_control_t
+__mips_fpu_getcw (void)
+{
+ fpu_control_t cw;
+
+ _FPU_GETCW (cw);
+ return cw;
+}
+
+void
+__mips_fpu_setcw (fpu_control_t cw)
+{
+ _FPU_SETCW (cw);
+}
--
Joseph S. Myers
joseph@codesourcery.com