[AVR] Linker error - undefined label

Summary

Linker error: undefined reference to `.Ljxxx' when using certain system functionality (string manipulation, writeln...)

System Information

  • Operating system: Embedded
  • Processor architecture: AVR
  • Compiler version: main (98ec8189)
  • Device: microcontroller

Steps to reproduce

Compile any program that manipulates strings (e.g. example below), or writeln.

Example Project

program test;

var
  s: shortstring;

begin
  s := '0' + s;
end.

Compile as follows:

~/fpc/installs/lib/fpc/3.3.1/ppcrossavr -Wpatmega328p -vhiwn -XPavr- testempty.pp 
Hint: Start of reading config file /home/christo/.fpc.cfg
Hint: End of reading config file /home/christo/.fpc.cfg
Target OS: Embedded
Compiling testempty.pp
testempty.pp(7,14) Warning: Variable "s" does not seem to be initialized
Assembling testempty
Linking testempty
/home/christo/fpc/installs/lib/fpc/3.3.1/units/avr-embedded/rtl/avr5/system.o: In function `fpc_shortstr_concat':
system.pp:(.text.n_fpc_shortstr_concat+0x7a): undefined reference to `.Lj426'
system.pp:(.text.n_fpc_shortstr_concat+0x7a): relocation truncated to fit: R_AVR_7_PCREL against undefined symbol `.Lj426'
testempty.pp(7,12) Error: Error while linking
testempty.pp(7,12) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

What is the current bug behavior?

Linker encountered undefined reference in RTL system unit.

What is the expected (correct) behavior?

All references emitted by compiler should be valid.

Relevant logs and/or screenshots

Possible fixes

Edited by ccrause
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information