Not able to see all the symbols in the output of "nm" command

Madhavi Manchala madhavi.linux at gmail.com
Thu Apr 14 09:21:08 EDT 2011


Dear Mulyadi Santosa,

On Thu, Apr 14, 2011 at 5:41 PM, Mulyadi Santosa
<mulyadi.santosa at gmail.com> wrote:
> Hi Madhavi :)
>
> On Thu, Apr 14, 2011 at 05:55, Madhavi Manchala <madhavi.linux at 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
>



More information about the Kernelnewbies mailing list