[fpc-devel] Internal linker bug?

patspiper patspiper at gmail.com
Thu Jun 25 13:26:32 CEST 2015


Linking a pascal project (with {$L mylib.obj}) with a specific .obj 
(COFF32) file using the internal linker (Windows) yields an executable 
that produces an exception when run. On the other hand, the external 
linker produces a sane executable.

The executable is supposed to contain calls from a unit to public 
functions in the .obj file, but these calls are to incorrect locations 
while the surrounding code is correct, hence the exception.
External linker (correct): call function1
Internal linker  (wrong) :  call <fpc_widestr_to_ansistr+40>

A dump of the .obj file shows that all public functions have an offset 
(value) in the symbol table, but no relocation entry, whereas 
Static/Nonpublic and external symbols have a relocation entry even if 
the symbol table entry offset (value) is 0.

Is this a bug in the internal linker especially that the external linker 
does exhibit this behaviour?

Note: I am not too involved in .obj formats, so pls bear with me if the 
above is inaccurate.


More information about the fpc-devel mailing list