aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2017-04-25 02:40:43 -0700
committerJose E. Marchesi <jose.marchesi@oracle.com>2017-04-25 02:40:43 -0700
commitd28b6364b1fba1c0270c001f0d82a69e351e1922 (patch)
tree61ff672a6b23b9d9c6874cdc79c64cdde890c8d7 /gas/config
parentb0b92aeb3828219075fce23543fb39fee8608e99 (diff)
downloadgdb-d28b6364b1fba1c0270c001f0d82a69e351e1922.zip
gdb-d28b6364b1fba1c0270c001f0d82a69e351e1922.tar.gz
gdb-d28b6364b1fba1c0270c001f0d82a69e351e1922.tar.bz2
gas: sparc: fix relaxation of CALL instruction into branches in a.out targets
This patch avoids CALL instructions to be optimized into branches if the symbols referred to in the CALL instruction are not fully resolved at the time the assembler writes its output. Tested in sparc64-linux-gnu and sparc-sun-sunos4.1.3 targets. No regressions. gas/ChangeLog: 2017-04-25 Jose E. Marchesi <jose.marchesi@oracle.com> PR gas/21407 * config/tc-sparc.c (md_apply_fix): Do not transform `call' instructions into branch instructions in fixups generating additional relocations. * testsuite/gas/sparc/call-relax.s: New file. * testsuite/gas/sparc/call-relax.d: Likewise. * testsuite/gas/sparc/call-relax-aout.d: Likewise. * testsuite/gas/sparc/sparc.exp: Test call-relax and call-relax-aout.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-sparc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 030e10d..4c930b5 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -3584,8 +3584,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED)
insn |= val & 0x3fffffff;
- /* See if we have a delay slot. */
- if (sparc_relax && fixP->fx_where + 8 <= fixP->fx_frag->fr_fix)
+ /* See if we have a delay slot. In that case we attempt to
+ optimize several cases transforming CALL instructions
+ into branches. But we can only do that if the relocation
+ can be completely resolved here, i.e. if no undefined
+ symbol is associated with it. */
+ if (sparc_relax && fixP->fx_addsy == NULL
+ && fixP->fx_where + 8 <= fixP->fx_frag->fr_fix)
{
#define G0 0
#define O7 15