This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pc-relative symbol resolution bug


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]