binutils-esp32ulp icon indicating copy to clipboard operation
binutils-esp32ulp copied to clipboard

JUMP cannot reach address beyond 1FF (2047)

Open 3615JMD opened this issue 5 years ago • 0 comments

Hi Of course this issue appears only on large assembly programs A JUMP instruction with absolute adress beyond 01FF will generate this error:

Error: rel too far BFD_RELOC_16

I beleive i have found the issue in file ....\gas\config\tc-esp32s2ulp.c line 115:

case BFD_RELOC_ESP32S2ULP_16_IMM:
	if (fixP->fx_addsy != NULL)// relocation will be done not in linker
	{
		asymbol *sym = symbol_get_bfdsym(fixP->fx_addsy);
		int force_reloc = S_FORCE_RELOC(fixP->fx_addsy, 1);
		//printf("force_reloc = %i \n", force_reloc);
		if (force_reloc != 0) if (sym->section->flags != 0) value = value >> 2;
	}
	if ((value < 0) || (value > 2047))		// <<<<<<<<<<<<<<<<<<<<<<<< HERE ! 
		as_bad_where(fixP->fx_file, fixP->fx_line, _("rel too far BFD_RELOC_16"));

if (value > 2047) it generates an error. the value should'nt it be 8191 instead ?

best regards, Jean Marc

3615JMD avatar Feb 05 '20 10:02 3615JMD