Skip to content

Commit

Permalink
Fix mips16 __fpu_control static linking (bug 18397).
Browse files Browse the repository at this point in the history
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.

	[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.
  • Loading branch information
Joseph Myers committed May 11, 2015
1 parent b13b96c commit 34cb304
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
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.

2015-05-11 Andreas Schwab <schwab@suse.de>

[BZ #18007]
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Version 2.22
18007, 18019, 18020, 18029, 18030, 18032, 18036, 18038, 18039, 18042,
18043, 18046, 18047, 18068, 18080, 18093, 18100, 18104, 18110, 18111,
18125, 18128, 18138, 18185, 18197, 18206, 18210, 18211, 18247, 18287,
18319, 18333, 18346.
18319, 18333, 18346, 18397.

* Cache information can be queried via sysconf() function on s390 e.g. with
_SC_LEVEL1_ICACHE_SIZE as argument.
Expand Down
3 changes: 3 additions & 0 deletions sysdeps/mips/mips32/fpu/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ifeq ($(subdir),math)
aux += fpucw-helpers
endif
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

#include <math/fpu_control.c>
#include <fpu_control.h>

fpu_control_t
__mips_fpu_getcw (void)
Expand Down

0 comments on commit 34cb304

Please sign in to comment.