kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: madhavi.linux@gmail.com (Madhavi Manchala)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Not able to see all the symbols in the output of "nm" command
Date: Thu, 14 Apr 2011 18:51:08 +0530	[thread overview]
Message-ID: <BANLkTimHk+vBoJX+hOhZiDWvoW_4GoyRpA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTik7QWRZET-Eiup4PLarDqmaJ8Surw@mail.gmail.com>

Dear Mulyadi Santosa,

On Thu, Apr 14, 2011 at 5:41 PM, Mulyadi Santosa
<mulyadi.santosa@gmail.com> wrote:
> Hi Madhavi :)
>
> On Thu, Apr 14, 2011 at 05:55, Madhavi Manchala <madhavi.linux@gmail.com> wrote:
>> The functions which are available in the header file are "INLINE"
>> functions.
>
> I see. Well, think "inline" function like another form of macro. So,
> they are inlined at the point they are called. This is different with
> non inline function...they are called, most likely by executing "call"
> instruction (in x86 assembly)
>
>>However, there are few functions, which are available in
>> the C files, also not able to see in the output of the "nm" command.
>> Is there any idea?
>
> Can you tell me their prototypes? just 2 or 3 of them? Quite likely
> either they are explicitly inline function or decided by gcc to be
> inlined because they are simple enough (thus "call" is considered a
> bit expensive to do)

The prototypes are as follows.
static unsigned int get_tacc(unsigned long hclk_tns,
			                 unsigned long val)
static unsigned int get_0124(unsigned long hclk_tns,
			                 unsigned long val)
static int calc_tacc(unsigned int cyc, int nwait_en,
		     unsigned long hclk_tns, unsigned long *v)

The first two functions are having only two lines of code each (one is
the return statement out of two statements). So, the gcc made them as
inline (just guess). However, the 3rd function is as follows.

static int calc_tacc(unsigned int cyc, int nwait_en,
		     unsigned long hclk_tns, unsigned long *v)
{
	unsigned int div = to_div(cyc, hclk_tns);
	unsigned long val;

	s3c_freq_iodbg("%s: cyc=%u, nwait=%d, hclk=%lu => div=%u\n",
		       __func__, cyc, nwait_en, hclk_tns, div);

	/* if nWait enabled on an bank, Tacc must be at-least 4 cycles. */
	if (nwait_en && div < 4)
		div = 4;

	switch (div) {
	case 0:
		val = 0;
		break;

	case 1:
	case 2:
	case 3:
	case 4:
		val = div - 1;
		break;

	case 5:
	case 6:
		val = 4;
		break;

	case 7:
	case 8:
		val = 5;
		break;

	case 9:
	case 10:
		val = 6;
		break;

	case 11:
	case 12:
	case 13:
	case 14:
		val = 7;
		break;

	default:
		return -1;
	}

	*v |= val << 8;
	return 0;
}

I did not find this function name also in the output of the "nm"
command. Is there any reason for this?

By the way, I also changed the inline functions to normal functions
i.e. I removed the inline keyword. Even after changing to normal
functions, I did not find them in the ouput of  the "nm" command. The
proto types are as follows.

static void arch_decomp_wdog_start(void)
static void putc(int ch)

Please let me know, if there is any reason for this.

Thanks for your information.

Regards,
Madhavi M.

>> Inlined functions are not visible in the output of the "nm" command.
>> Is this known behaviour?
>
> yes...if the function is inlined, there is no need to refer to the
> function name (the symbol), right?
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
>

  reply	other threads:[~2011-04-14 13:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13 15:21 Not able to see all the symbols in the output of "nm" command Madhavi Manchala
2011-04-14  2:46 ` Mulyadi Santosa
2011-04-14  4:55   ` Madhavi Manchala
2011-04-14 12:11     ` Mulyadi Santosa
2011-04-14 13:21       ` Madhavi Manchala [this message]
2011-06-10  0:12         ` Gavin Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTimHk+vBoJX+hOhZiDWvoW_4GoyRpA@mail.gmail.com \
    --to=madhavi.linux@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).