Skip to content

Incorrect relative address error #4

Open
@Mucka

Description

@Mucka

Apperance of an error:
coprocessor.ulp.pS:276: Error: rel too far BFD_JUMPR_STEP
do not depend on relative position of instructions but for some reason on absolute position of instruction. Above error appears in my code:

jumpr quit, 256, ge
halt
quit: wake

when those lines are very far away e.g.

 276 ???? 00010182 	    jumpr quit, 256, ge
 277 ???? 000000B0 	    halt
 278              	quit:
 279 ???? 01000090 	    wake

but won't appear if those lines are at the beginning of code. The problem also affects jumps instruction.

EDIT: I have found that if label which i selected to jump into is going to be over 0x0200 address in resultant code, such error appears, so I can generate code:

 186 01f8 00000040 	    nop
 187              	test1:
 188 01fc 00010182 	    jumpr test1, 256, ge
 189              	test2:
 190 0200 00000040 	    nop

when i try to jump to test1, but only when I try to jump into test2 I get:

coprocessor.ulp.pS: Assembler messages:
coprocessor.ulp.pS:188: Error: rel too far BFD_JUMPR_STEP
 186 ???? 00000040 	    nop
 187              	test1:
 188 ???? 00010182 	    jumpr test2, 256, ge
 189              	test2:
 190 ???? 00000040 	    nop

the error is thrown by function md_apply_fix in file gas/config/tc-esp32ulp.c, but the condition checked there seems legit:

	case BFD_RELOC_ESP32ULP_JUMPR_STEP:
		if ((value > 0x1FF) || (value < -0x1ff))
			as_bad_where(fixP->fx_file, fixP->fx_line, _("rel too far BFD_JUMPR_STEP"));

because it assume (i hope) that value is relative offset of jump, but for some reason in this case it is not, and it happened to be absolute offset of jump, I am not sure from where this function is called, because I am not so familiar with binutils source code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions