I'm following the osdev wiki meaty skeleton tutorial but using nasm as an assembler instead of GAS because i'm more familiar with nasm, but when i try to compile the init function using nasm the program hangs, however if i use GAS to compile it, it works and calls constructors. Here is the original crti.S:
.section .init
.global _init
.type _init, @function
_init:
push %ebp
movl %esp, %ebp
.section .fini
.global _fini
.type _fini, @function
_fini:
push %ebp
movl %esp, %ebp
And here is the version that i wrote for nasm:
section .init
global _init:function
_init:
push ebp
mov esp, ebp
section .fini
global _fini:function
_fini:
push ebp
mov esp, ebp
I think they are the same but for some reason i can't get the constructors to be called with nasm, as i said, the program hangs when i call the init function.
Some additional info, the other assembly filles are compiled with nasm and they work fine, i was able to call the _init function when compiled using GAS and it worked.
GAS compiler command:
i686-elf-gcc --sysroot=/home/manuel/Documentos/OSDEV/XeonOS/sysroot -isystem=/usr/include -c arch/i386/crti.S -o arch/i386/crti.o -O2 -g -ffreestanding -fbuiltin -Wall -Wextra -Werror -D__is_xeonos_kernel -Iinclude
NASM compiler command:
nasm -f elf32 arch/i386/crti.asm -o arch/i386/crti.o