This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH]: HC11 linker relax fixes (potential pb on other relax targets)
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Stephane Carrez <stephane dot carrez at free dot fr>
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 8 Apr 2003 22:11:18 +0930
- Subject: Re: [PATCH]: HC11 linker relax fixes (potential pb on other relax targets)
- References: <3E8DF6ED.7050605@free.fr>
On Fri, Apr 04, 2003 at 11:19:41PM +0200, Stephane Carrez wrote:
> - when we adjust the symbols after removing bytes, we must take into
> account the symbol that marks the end of the section. The test that
> exists
> in the bfd relax targets (and that I copied!) is:
>
> if (isym->st_shndx == sec_shndx
> && isym->st_value > addr
> && isym->st_value < toaddr)
>
> and it is not correct if there is a section that defines a label at its
> very end.
> It will not be adjusted.
I wonder why there is any test of symbol value against "toaddr"? It
seems to me that this test is bogus, and your replacement of "< toaddr"
with "<= toaddr" just fixes one particular symbol value. For instance,
suppose we have
.text
nop
nop
sym1:
sym2 = sym1 + 2
and the relax pass decides to delete one of the nops. Shouldn't sym2
be decremented? Of course, you could argue that
sym3 = .text + 4
might be better left alone, but that just demonstrates the fragility
of adjusting symbols based on their value.
--
Alan Modra
IBM OzLabs - Linux Technology Centre