__exit macro : how are the exit.* sections handled ?

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

 



Hi all,

I was looking at the __exit macro definition in include/linux/init.h :

#define __exitdata      __attribute__ ((__section__(".exit.data")))
#define __exit_call     __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))

#ifdef MODULE
#define __exit          __attribute__ ((__section__(".exit.text")))
#else
#define __exit          __attribute_used__ __attribute__ ((__section__(".exit.text")))
#endif

So this means that __exit macros will put the function or the data into
the respective exit sections.

I quickly look at the vmlinux.lds file and I see the comment :

/* 
 * .exit.text is discard at runtime, not link time, to deal with references
 * from .altinstructions and .eh_frame 
 */

For me, it makes sense to discard an exit function compiled statically :
it will never be called.

But if it's a module __exit function, we shouldn't discard it. So if
module support is enabled, the __exit function is different : it uses
the __attribute_used__ gcc attribute so that the function won't be
discarded at run time. 

I guess I understood :)

But what is the purpose of the exitcall section ? Shouldn't it be the
section for module in fact ?

Thanx and correct me if something is wrong,

-- 
tyler
tyler@xxxxxxxx


	

	
		
___________________________________________________________________________ 
Faites de Yahoo! votre page d'accueil sur le web pour retrouver directement vos services préférés : vérifiez vos nouveaux mails, lancez vos recherches et suivez l'actualité en temps réel. 
Rendez-vous sur http://fr.yahoo.com/set


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux