Date: 02 Aug 1999 14:14:24 +0800 From: Joe Jih-Shien Lu <JoeLu@joelu.m8.ntu.edu.tw> To: freebsd-hackers@FreeBSD.org Subject: How the `struct linker_set' is used in building an ELF kernel? Message-ID: <87n1wag14v.fsf@JoeLu.m8.ntu.edu.tw>
next in thread | raw e-mail | index | archive | help
Hi everybody, I started studying 3.2-stable kernel source for days. There are some questions I cannot figure out in an ordinary C programmer's point of view: * In cninit(), it references a global variable `cons_set' of the type `struct linker_set,' but I don't see its definition in any of the source files except the setdef0.c generated by /usr/bin/gensetdefs. It is defined by the .long asm psuedo-op, and seems to have the size of 4 bytes. However, in /sys/i386/i386/cons.h, it is declared as of the type `struct linker_set' which is 8-byte long. This inconsistency confused me. * Similar problem is encountered when I'm poking around the system initializing for-loop in main(). sysinit_set, declared as struct linker_set, is referenced, but I can't get into the way how this variable is initialized. I guess it is the linker who did all the magic, since the comment in /sys/sys/linker_set.h mentioned about it. After studying the linker script (/sys/i386/conf/kernel.script) and ld.info, though, I still don't have any idea about the details behind the scene. I notice that gensetdefs looks for the sections by the `.set.'-prefixed name in all the ELF kernel object files, and produces the setdef[12].c accordingly. Does the `.set.'-prefixed section name have any special meaning in an ELF object file? I hope someone can give me a hint, thanks. -- Joe Jih-Shien Lu [¿c¬ö¾Ë] mailto:b84118@ee.ntu.edu.tw ---------------------------------------------------------------------- The trouble with being poor is that it takes up all your time. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87n1wag14v.fsf>