View Issue Details

IDProjectCategoryView StatusLast Update
0036931FPCCompilerpublic2020-10-28 21:28
ReporterChristo Crause Assigned To 
PrioritynormalSeverityminorReproducibilitysometimes
Status newResolutionopen 
Product Version3.3.1 
Summary0036931: Xtensa - Linker error when linking a freertos demo program
DescriptionWhen linking a wifi example program using ESP-IDF libraries the linker generates an error:

/fpc/avr-new/rtl/units/xtensa-freertos/system.o: in function `SYSTEM_$$_SYSTEM_EXIT':
system.pp:(.text.n_SYSTEM_$$_SYSTEM_EXIT+0x0): dangerous relocation: j: cannot encode: _haltproc

Compiling and linking simpler examples work, so I suspect that the range between the jump instruction and the _haltproc address exceeds about 131070 bytes. In the general case it seems safer to rather generate a J.L macro so that the linker can decide whether J or JX can be used. The downside is of course that an extra register needs to be passed to J.L.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Florian

2020-04-19 09:38

administrator   ~0122241

I implemented a first workaround in r44837. Note: this is not save yet because it might destroy an argument in a15.

Christo Crause

2020-04-19 11:38

reporter   ~0122243

The work-around fixes my linking problem, thanks Florian. I'm keen to see a proper fix!

Christo Crause

2020-08-22 16:28

reporter   ~0125079

If proposal 0037620 is accepted, register a0 is available as operand for jump instructions.

Florian

2020-10-25 18:18

administrator   ~0126547

The problem with a0 is that a register is needed which is available in some call trampoline: trampolines are typically called by a call instruction and then jump to the final code by a J.L. In this case a0 is not available.

Christo Crause

2020-10-28 21:00

reporter   ~0126613

Thanks for explaining the problem Florian. I guess the real complication is that a register needs to be used after the register allocater pass is done, so it cannot use a general register?

Florian

2020-10-28 21:28

administrator   ~0126614

No, the complication is that it is used e.g. in trampolines: trampolines never safe any registers, as said, they e.g. just redirect a call by a jump.

Issue History

Date Modified Username Field Change
2020-04-18 14:57 Christo Crause New Issue
2020-04-19 09:38 Florian Note Added: 0122241
2020-04-19 11:38 Christo Crause Note Added: 0122243
2020-08-22 16:28 Christo Crause Note Added: 0125079
2020-10-25 18:18 Florian Note Added: 0126547
2020-10-28 21:00 Christo Crause Note Added: 0126613
2020-10-28 21:28 Florian Note Added: 0126614