This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] MIPS/GAS: Cut TLS reloc dead code path in `md_apply_fix'


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4512dafa508c4b148996f2d67222a82dd018cdd3

commit 4512dafa508c4b148996f2d67222a82dd018cdd3
Author: Maciej W. Rozycki <macro@imgtec.com>
Date:   Tue May 24 14:05:19 2016 +0100

    MIPS/GAS: Cut TLS reloc dead code path in `md_apply_fix'
    
    With code refactoring made in commit b886a2ab0d52 and the addition of
    `calculate_reloc' and a separate test for TLS relocs against constants
    made there the preexisting fall-through from the TLS reloc switch case
    has effectively become a dead execution path.  This is because the call
    to `calculate_reloc' present there is only made if `fixP->fx_done' is
    true, which can only be the case if `fixP->fx_addsy' is NULL, which in
    turn has already triggered the TLS reloc test and made execution break
    out of the switch statement.
    
    Remove the fall-through then and reshape code accordingly.
    
    	gas/
    	* config/tc-mips.c (md_apply_fix)
    	<BFD_RELOC_MIPS16_TLS_TPREL_LO16>: Remove fall-through, adjust
    	code accordingly.

Diff:
---
 gas/ChangeLog        |  6 ++++++
 gas/config/tc-mips.c | 14 ++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 3fae338..8cf0a50 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2016-05-24  Maciej W. Rozycki  <macro@imgtec.com>
+
+	* config/tc-mips.c (md_apply_fix)
+	<BFD_RELOC_MIPS16_TLS_TPREL_LO16>: Remove fall-through, adjust
+	code accordingly.
+
 2016-05-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
 
 	* config/tc-xtensa.c (struct suffix_reloc_map): Change type of field
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index f58955c..82bd830 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -14904,14 +14904,12 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
     case BFD_RELOC_MIPS16_TLS_GOTTPREL:
     case BFD_RELOC_MIPS16_TLS_TPREL_HI16:
     case BFD_RELOC_MIPS16_TLS_TPREL_LO16:
-      if (!fixP->fx_addsy)
-	{
-	  as_bad_where (fixP->fx_file, fixP->fx_line,
-			_("TLS relocation against a constant"));
-	  break;
-	}
-      S_SET_THREAD_LOCAL (fixP->fx_addsy);
-      /* fall through */
+      if (fixP->fx_addsy)
+	S_SET_THREAD_LOCAL (fixP->fx_addsy);
+      else
+	as_bad_where (fixP->fx_file, fixP->fx_line,
+		      _("TLS relocation against a constant"));
+      break;
 
     case BFD_RELOC_MIPS_JMP:
     case BFD_RELOC_MIPS_SHIFT5:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]