Re: How to determine linkage of a function at run-time?

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

 



On Thu, Jun 26, 2003 at 01:10:16AM +0200, Lukas Ruf wrote:
> 
> Dr William Bland <wjb@abstractnonsense.com> [2003-06-25 23:27]:
> > Lukas Ruf wrote:
> > 
> > >> I would think that, when you call a function using a function pointer,
> > >> gcc will assume that all arguments get passed on the stack
> > >> (asmlinkage) since it can't know anything about the function's actual
> > >> linkage.
> > > 
> > > Have you checked what asmlinkage does?  IIRC this is defined in
> > > include/linux/linkage.h.
> > 
> > Yes I have.  It defines __attribute__((regparm(0))), which tells gcc to
> > pass all the function's arguments on the stack - *not* in registers (which
> > is something gcc sometimes does to make things faster).
> > 
> 
> well, but isn't the register calling semantic reserved just for
> syscalls  -- maybe I am mistaken....  Thus, if all functions either
> statically linked or loaded as modules are not syscalls, the standard
> calling syntax, i.e. stack-based, is used.  Further, isn't it
> depending on the platform, you base your implementation on?

I don't think that can be the case as lots of kernel functions are defined
with asmlinkage.  If it was only syscalls that passed their arguments in
registers, what would be the point of these declarations?  It probably is
architecture-dependant though.

Best wishes,
		Bill.
-- 
Dr. William Bland.                          Computer Programmer, UK.
www.abstractnonsense.com
--
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