* [committed] MIPS/GAS: Cut TLS reloc dead code path in `md_apply_fix'
@ 2016-05-24 13:41 Maciej W. Rozycki
0 siblings, 0 replies; only message in thread
From: Maciej W. Rozycki @ 2016-05-24 13:41 UTC (permalink / raw)
To: binutils
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.
---
No regressions against MIPS targets. I have applied this change now.
Maciej
binutils-mips-gas-apply-fix-tls.diff
Index: binutils/gas/config/tc-mips.c
===================================================================
--- binutils.orig/gas/config/tc-mips.c 2016-05-23 13:50:21.000000000 +0100
+++ binutils/gas/config/tc-mips.c 2016-05-23 13:52:20.897428872 +0100
@@ -14904,14 +14904,12 @@ md_apply_fix (fixS *fixP, valueT *valP,
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:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-05-24 13:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-24 13:41 [committed] MIPS/GAS: Cut TLS reloc dead code path in `md_apply_fix' Maciej W. Rozycki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).