tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Linker error (multiple definition) during LD_STAGE 2 with custom scheduler



Hello,

I am working on porting a custom scheduler to NetBSD, cross-compiling on Void Linux using build.sh. I am trying to follow the modular design and using sched_m2.c as a reference.

My scheduler implements some of the core scheduling functions but still relies on kern_runq.c for the rest of the fallback logic. However, during LD_STAGE 2, the build fails with "multiple definition" errors because the linker hits identical symbols in both my scheduler's object file and kern_runq.o.

I have closely inspected kern_runq.c, and there are no conditional compilation macros (like #ifndef) to exclude these overlapping functions when a different scheduler is chosen.

Could someone please explain how the NetBSD build system and linker handle symbol overriding for alternative schedulers? How does sched_m2.c avoid multiple definition conflicts with kern_runq.c, and what is the proper way to hook a custom scheduler into the kernel to avoid this collision?

Please CC me in your replies, as I am not subscribed to the list.

Thank you,
[Timofey Maslennikov]


Home | Main Index | Thread Index | Old Index