https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61044

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gjl at gcc dot gnu.org,
                   |                            |senthil_kumar.selvaraj@atme
                   |                            |l.com

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
I don't see any difference in generated code with that patch.

Anyway, the question is /what/ the generated code should be?

The label differences would be something like

    .word pm(.L3-.L2)

because we must not generate stubs for the offset.  pm() works under the
assumption that gas does not resolve the difference and emits relocs for it,
and that pm() accepts differences.  Currently, gas will compute the difference
and come up with somethink like pm(4) which it resolves to 4 and not as 2.

Senthil, I searched for a user level documentation of -mlink-relax but with no
avail.  Is there a special reason for why there is no documentation for that
new gas command line option?

And why is this option needed in the first place? Why not always emitting
relocs for differences of labels? It does not buy us anything if gas computes
the difference ... except for annoyance like checking for -mlink-relax during
GCC configury.

What does not work is to add offsets to stub addresses, e.g. gs(.L2)+4 will
point to the next stub (if any) and *not* to .L2 + 4.  Thus, I don't think it's
worth to fix this PR and go through all the hassle with/without linker
relaxation and cater for all situations.

Instead, we should mention in the manual that the second example for computed
goto (with label differences) is not supported for AVR.  Not to mention that
alternative #1 will yield better code because there is not need to add offsets
at run time.

Reply via email to