I linked the object in the correct sequence,
Code: Select all
crti.o, crtbegin.o, All Kernel Objects, -lgcc, crtend.o, crtend.o
Code: Select all
0000438c <_init>:
438c: 55 push ebp
438d: 89 e5 mov ebp,esp
438f: e8 90 0d 00 00 call 5124 <hello+0xf4>
4394: e8 93 56 00 00 call 9a2c <SetupTSS+0x80>
4399: 5d pop ebp
439a: c3 ret
Few other notes:
1. I had to implement the functions below because of "undefined symbols" (weak symbols). Note that my ELF dynamic-linker (in the KernelHost module, which is actually a PIE) links the other modules. But my HAL module had undefined references to these functions.
Code: Select all
///
/// After looking around on the internet, I found them in the C library code. Just copied them from there
/// cause the comments said they were for initialization and really didn't need to do anything.
///
extern "C" void __register_frame_info(void*,struct object*){}
extern "C" void __register_frame_info_bases(void *a1, struct object *a2, void *a3, void *a4);
extern "C" void* __deregister_frame_info(void*){ return (null); }
These are for C++ exception support, right. I use --fno-exceptions; why did these symbols arise?
2. My kernel source - https://github.com/SukantPal/Silcos-Kernel
Goto KernelHost/Source/ModuleLoader for the module-loader. You'll find the ElfLinker.cpp file which has these "undefined" functions implemented.