Skip to content

Commit

Permalink
soft-fp: Use __label__ for all labels within macros.
Browse files Browse the repository at this point in the history
soft-fp has various macros containing labels and goto statements.
Because label names are function-scoped, this is problematic for using
the same macro more than once within a function, which some
architectures do in the Linux kernel (the soft-fp version there
predates the addition of any of these labels and gotos).  This patch
fixes this by using __label__ to make the labels local to the block
with the __label__ declaration.

Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by this patch.

	* soft-fp/op-common.h (_FP_ADD_INTERNAL): Declare labels with
	__label__.
	(_FP_FMA): Likewise.
	(_FP_TO_INT_ROUND): Likewise.
	(_FP_FROM_INT): Likewise.
  • Loading branch information
jsm28 committed Jan 22, 2015
1 parent 6b2ba95 commit d742385
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2015-01-22 Joseph Myers <[email protected]>

* soft-fp/op-common.h (_FP_ADD_INTERNAL): Declare labels with
__label__.
(_FP_FMA): Likewise.
(_FP_TO_INT_ROUND): Likewise.
(_FP_FROM_INT): Likewise.

2015-01-21 Adhemerval Zanella <[email protected]>

[BZ #16418]
Expand Down
5 changes: 5 additions & 0 deletions soft-fp/op-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@
if (X##_s == Y##_s) \
{ \
/* Addition. */ \
__label__ add1, add2, add3, add_done; \
R##_s = X##_s; \
int _FP_ADD_INTERNAL_ediff = X##_e - Y##_e; \
if (_FP_ADD_INTERNAL_ediff > 0) \
Expand Down Expand Up @@ -599,6 +600,7 @@
else \
{ \
/* Subtraction. */ \
__label__ sub1, sub2, sub3, norm, sub_done; \
int _FP_ADD_INTERNAL_ediff = X##_e - Y##_e; \
if (_FP_ADD_INTERNAL_ediff > 0) \
{ \
Expand Down Expand Up @@ -933,6 +935,7 @@
#define _FP_FMA(fs, wc, dwc, R, X, Y, Z) \
do \
{ \
__label__ done_fma; \
FP_DECL_##fs (_FP_FMA_T); \
_FP_FMA_T##_s = X##_s ^ Y##_s; \
_FP_FMA_T##_e = X##_e + Y##_e + 1; \
Expand Down Expand Up @@ -1531,6 +1534,7 @@
#define _FP_TO_INT_ROUND(fs, wc, r, X, rsize, rsigned) \
do \
{ \
__label__ _FP_TO_INT_ROUND_done; \
if (X##_e < _FP_EXPBIAS_##fs) \
{ \
int _FP_TO_INT_ROUND_rounds_away = 0; \
Expand Down Expand Up @@ -1742,6 +1746,7 @@
#define _FP_FROM_INT(fs, wc, X, r, rsize, rtype) \
do \
{ \
__label__ pack_semiraw; \
if (r) \
{ \
rtype _FP_FROM_INT_ur; \
Expand Down

0 comments on commit d742385

Please sign in to comment.