Calling global constructors, linking problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Dennisbonke
Posts: 15
Joined: Sun Aug 09, 2015 7:23 pm
Libera.chat IRC: Dennisbonke

Calling global constructors, linking problem

Post by Dennisbonke »

Hello everyone,

I'm pretty new to OS development, and as such, I've a problem.
After doing the basic stuff (bare bones, meaty skeleton, etc) and basing my own OS on it, I decided to try and call the global constructors, because it isn't much work to do so.
However, trying to do this as described in the meaty skeleton wiki page, my linker refuses to link, saying that there are multiple definitions of _init and _ fini.
I've searched the forums, google and the wiki for over a day now, and I found nothing that solved my problem.
If any of you guys could help me out with this, I would greatly appreciate it.

Some information about my setup:
Linux: Kali linux x64 version 1.1.0a (latest release at this time).
GCC version: 4.8.2 (ofcourse builded as an cross-compiler).
Binutils version: 2.24.
A link to my OS github page (is easier then pasting files here).

If you need any more information, please let me know.

Dennis
Hi, I'm Dennis, the resident port maintainer of Managarm!
Happy to help or answer questions, porting software is my speciality but I'll try everything.
Please correct my English as I'm not a native speaker of it.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Calling global constructors, linking problem

Post by Combuster »

If it says there's duplicate, why would there not be a duplicate?

Code: Select all

$(LD) $(LDFLAGS) -o $(PROGRAM)	$(CRTI_OBJ) \
   (...)
									kernel32/arch/*.o 	\
   (...)
									$(CRTN_OBJ)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Dennisbonke
Posts: 15
Joined: Sun Aug 09, 2015 7:23 pm
Libera.chat IRC: Dennisbonke

Re: Calling global constructors, linking problem

Post by Dennisbonke »

I'm stupid, thanks for you reply!
Hi, I'm Dennis, the resident port maintainer of Managarm!
Happy to help or answer questions, porting software is my speciality but I'll try everything.
Please correct my English as I'm not a native speaker of it.
Post Reply