Relocation fails when linking static libraries
Using the -rz80 option to generate relocatable code, creates incorrect relocation table offsets when using static linking of libraries (-i option).
The implementation of relocation addresses were assuming that all relocatable address expressions in pass 2 linking were in chronological order. However, this is not really the case since statically linked library modules are added in any kind of order (by recursive reference to each other).
The solution is to register all relocatable elements by ascending address during pass 2 linking. The relocatable address table is then generated when the relocation header is about to be written in front of the linked executbale binary.