This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: pc-relative symbol resolution bug
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Richard Henderson <rth at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Fri, 30 Aug 2002 20:46:27 +0930
- Subject: Re: pc-relative symbol resolution bug
- References: <20020829175511.GA537@redhat.com>
On Thu, Aug 29, 2002 at 10:55:11AM -0700, Richard Henderson wrote:
> The following test case:
>
> .section .rodata
> A:
> .align 4
> .long B-.+(.-A)
> .text
> B:
>
> results in
>
> z.s:4: Error: invalid section for operation
>
> This only happens when (.-A) spans two fragments, and
> thus cannot be ireduced to a constant by expr.
>
> This affects large x86-64 switch statements, as currently
> emitted by gcc. I have a work-around, which is to form
> the expression as
>
> .long B+(.-A)-.
Is "B-A" too obvious?
> instead. Seems to me that both forms ought to work, but
> it looks decidedly wicked to attempt with the current
> order of evaluation within gas.
There are two problems to solve. The first one, which is easy,
is to teach resolve_symbol_value that "sym1 - sym2" expressions
are OK when sym2 is in the current section and DIFF_EXPR_OK is
defined. The second, not so easy problem, is to correct all
the "segment of expression" evaluations without breaking
everything or allowing nonsense expressions. What should the
segment be for "other_non_abs_seg_sym - this_seg_sym"?
--
Alan Modra
IBM OzLabs - Linux Technology Centre