pc-relative symbol resolution bug

Richard Henderson rth@redhat.com
Thu Aug 29 10:55:00 GMT 2002


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)-.

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.


r~



More information about the Binutils mailing list