Re: EXPORT_SYMBOL

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

 



>> kanishk rastogi schrieb:
>> > hi all,
>> > When we export a symbol using EXPORT_SYMBOL, We can use it to be called
>> > by other modules when we insert this module .......
>> > I wanted to know when does this symbol gets added to the kernel symbol
>> > table ...
>>
>> It's added when the module is loaded with insmod and removed when the
>> module is removed.
>> But you don't have to use EXPORT_SYMBOL. if you don't care about it,
>> every symbol, that is not static will be exportet.

That's no longer true, you explicitly need to use EXPORT_SYMBOL to
export a symbol. IIRC this was done to avoid namespace polution and to
force people to think about what symbols to export (i.e.: think about
the exported interface).

> Does this means EXPORT_SYMBOL()  and declaring a function as
> non-static is same ....

No, see above.

>> > Or what happens when we insert the module so that this symbol is
>> > accessible ....
>>
>> If you want to check which symbols of your module are exported, check
>> /proc/kallsyms.
>
> But i wanted to see what special treament does these symbols get once
> we have "EXPORT_SYMBOL()ed " them
> Vs....
> ones which are not exported and non static .....

The ones not having an EXPORT_SYMBOL() are not exported, don't show up
in /proc/kallsyms,

They still show up in kallsyms , but with "t"( local text section)
If you EXPORT/non-static , they'll be "T"(global text section)

Check
refresh_cpu_vm_stats "T" --> non static/not EXPORT'ed
__refresh_cpu_vm_stats "t" --> static
refresh_vm_stats "T" --> EXPORT'ed


and can't be used by other modules.


Thanks,
-Guru




[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