These days I am trying to craft my Linker(pre-release version of the Linker) unild for linking the compiled object files to the executable in Linux.
However,I encountered some errors when I use my DIY linker to link the compiled and assembled object files to the executable and then execute it.I have coding a minimal error project to reproduce the error I have met(Segmentation fault).
The details of the error was(which GNU Debugger(GDB) displays):
Program received signal SIGSEGV, Segmentation fault.
SYSTEM_$$_init$ () at system.pp:691
691 begin
(gdb) bt
#0 SYSTEM_$$_init$ () at system.pp:691
#1 0x0000000000416b37 in fpc_initializeunits () at ../inc/system.inc:1170
#2 0x0000000000400143 in main () at example.pas:5
Both the unild source code and test code attached on the attachments,The testing code is:
program test;
{$MODE ObjFPC}{$H+}
begin
writeln('This is a Hello World Program!');
end.
The Attachment errorproject.zip consists two folder unild and testexample.
Please install the FPC trunk version to compile these two projects.
After the FPC trunk on ready,You must bash build.sh in the unild folder and then bash build.sh in the testexample folder,the second step that reproduce the Segmentation Fault(Must be Linux,cannot test the error on Windows and other due to the unild cannot recognize non-ELF object files).