Not able to see all the symbols in the output of "nm" command
Dear All, I build the OpenWRT image for my target device. I am able to see the "vmlinux" image in trunk/build_dir/linux-s3c2510/linux-2.6.36 directory where linux-s3c2510 indicates my target device. I am NOT able to see some of the function names (symbols), which I developed, in the output of the "nm" command for vmlinux image. Am I missing any thing while building the image for getting all the symbols into the image? I am NOT able to see all the function names which are defined in arch/arm/plat-samsung/include/uncompress.h file. Please let me know if I am missing any thing. Thanks for your suggestions / hints. Thanks and Regards, Madhavi M.
On Wed, Apr 13, 2011 at 22:21, Madhavi Manchala <madhavi.linux@gmail.com> wrote:
I am NOT able to see some of the function names (symbols), which I developed, in the output of the "nm" command for vmlinux image. Am I missing any thing while building the image for getting all the symbols into the image?
maybe because they are inlined? -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
Dear Mulyadi Santosa, On Thu, Apr 14, 2011 at 8:16 AM, Mulyadi Santosa <mulyadi.santosa@gmail.com> wrote:
On Wed, Apr 13, 2011 at 22:21, Madhavi Manchala <madhavi.linux@gmail.com> wrote:
I am NOT able to see some of the function names (symbols), which I developed, in the output of the "nm" command for vmlinux image. Am I missing any thing while building the image for getting all the symbols into the image?
maybe because they are inlined?
The functions which are available in the header file are "INLINE" functions. 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? Inlined functions are not visible in the output of the "nm" command. Is this known behaviour? Thanks for your information. Thanks and Regards, Madhavi M.
-- regards,
Mulyadi Santosa Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
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)
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
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
It is possible that non-inline function will be translated to inline function by compiler. when using back trace, I have suffered the problems that the function calling sequence is impossible, because one of the function is missed. Then I objdumped the elf file and found that the missing function is inlined by compiler; However, you can use 2 method, I knowed, to avoid being inlined by compiler: 1. Putting __attribute__((optimized("O0"))) before the function definition. 2. Using the following gcc extension usage to avoid optimization. #pragma GCC push_options #pragma GCC optimized("O0") your code block... #pragma GCC pop_options Gavin Guo
participants (3)
-
Gavin Guo -
Madhavi Manchala -
Mulyadi Santosa