[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: -relax broken for SH assembler
From: |
Nick Clifton |
Subject: |
Re: -relax broken for SH assembler |
Date: |
28 Jun 2001 16:48:55 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
Hi Richard,
> The SH4 assembler source
>
> .L3:
> mov.l .L13,r1
> .uses .L3
> jsr @r1
> nop
> .L13:
> .long foo
> When assembled with -relax
>
> 3.0-20010507/bin/sh-hitachi-elf-as -v -relax relax.s -o relax.o
>
> coredumps as follows
I believe that the patch below should fix this problem. Since I am
unfamilair with the SH assembler however, I am CC'ing this patch to
the SH maintainers (Hi Joern, Hi Hans-Peter) in case they care to
comment.
The problem, as I see it, is by the time sh_frob_section() is called
all the frag info for local symbols has been lost. This is because
resolve_symbol_value() has been called with finalize_syms set to
true. My solution is to use the frag attached to the fixup associated
with the original sym. This frag should be in the same section as the
sym, and I hope will cover the location of the sym, but I could not
decide if this will always be true. It certainly appears to be true
for the test case above.
Cheers
Nick
Index: gas/config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.39
diff -p -r1.39 tc-sh.c
*** tc-sh.c 2001/06/13 16:46:05 1.39
--- tc-sh.c 2001/06/28 15:41:48
*************** sh_frob_section (abfd, sec, ignore)
*** 2340,2348 ****
--- 2340,2354 ----
We have already adjusted the value of sym to include the
fragment address, so we undo that adjustment here. */
subseg_change (sec, 0);
+ #if 0
fix_new (symbol_get_frag (sym),
S_GET_VALUE (sym) - symbol_get_frag (sym)->fr_address,
4, &abs_symbol, info.count, 0, BFD_RELOC_SH_COUNT);
+ #else
+ fix_new (fscan->fx_frag,
+ S_GET_VALUE (sym) - fscan->fx_frag->fr_address,
+ 4, &abs_symbol, info.count, 0, BFD_RELOC_SH_COUNT);
+ #endif
}
}