Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about global constructors #43

Closed
cristian-programmer opened this issue Nov 5, 2019 · 8 comments
Closed

Question about global constructors #43

cristian-programmer opened this issue Nov 5, 2019 · 8 comments
Labels
legacy This item is related to pre-rewrite skiftOS

Comments

@cristian-programmer
Copy link
Contributor

Hello colleagues, why do you need to call global constructors before starting the kernel? I understand that in a user space program it is called before the main function, to do something,
But what should the core call before starting?

@cristian-programmer cristian-programmer changed the title global constructors Question about global constructors Nov 5, 2019
@sleepy-monax
Copy link
Member

If I recall correctly, the global constructor isn't getting called in the kernel

@RossComputerGuy
Copy link

If constructors aren't getting called then I think they shouldn't be added in, it'll save up binary space.

@sleepy-monax
Copy link
Member

It's C so there is no constructor to call, at least in the kernel, I know there is one in libposix to initialize stdio

@cristian-programmer
Copy link
Contributor Author

aa ok,
here the link: https://wiki.osdev.org/Calling_Global_Constructors#Using_crti.o.2C_crtbegin.o.2C_crtend.o.2C_and_crtn.o_in_a_Kerne
I have been reading about this article on osdev.org, in skifos I thought I saw the call to these constructors
@RossComputerGuy
That means that I don't necessarily need to call the builders, isn't it an obligation for the kernel?

@sleepy-monax
Copy link
Member

sleepy-monax commented Nov 5, 2019

Yes there is one call to init in the userspace side of libsystem

@cristian-programmer
Copy link
Contributor Author

@NicolasVanBossuyt good thank you, crt0.o crti.o, crtn.o
Isn't it really necessary to call these files objects?
that is mentioned in the osdev article

@sleepy-monax
Copy link
Member

Yes you have to have them or gcc will complain '^^

@cristian-programmer
Copy link
Contributor Author

Very Thanks!

@sleepy-monax sleepy-monax added the legacy This item is related to pre-rewrite skiftOS label May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy This item is related to pre-rewrite skiftOS
Projects
None yet
Development

No branches or pull requests

3 participants