On Mon, Mar 21, 2005 at 01:12:40AM +0100, Marek Michalkiewicz wrote:
> On the other hand, branches within the same function should avoid the
> extra jump and go to "1:" directly.  If the same label is used in both
> ways (direct jump/branch, and address taken), two separate labels (at
> the same address) should be output for both of these uses, but I'm not
> sure how to do this in GCC.  Any suggestions?

The easiest way is to do this in the linker instead of the compiler.
See the xstormy16 port and how it handles R_XSTORMY16_FPTR16.  This
has the distinct advantage that you do not commit to the creation of
an indirect jump until you discover that the target label is outside
the low 64k.

But failing that, you can override ASM_OUTPUT_LABEL to make sure that
the two labels get output; e.g.

.Lnnn:
        .section .text_low,"ax",@progbits
.Lnnn_low:
        jmp .Lnnn
        .previous

and then in print_operand_address you can mangle the name printed
when taking the address of a label.


r~

Reply via email to