This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC-3.4, official way to get size of functions ?


  Hello,

  For gujin, a project of mine, I need once to get
  the size in bytes of a function.
  Before GCC-3.4, I was getting the size of one function doing:

__attribute__ ((section (".xdata"))) __attribute__ ((cdecl, regparm (0)))
static unsigned
linux_set_params (unsigned totalmem,
		  struct loader_t bootloader_type,
		  struct linux_param *LnxParam,
		  struct LOADER_str *loader,
		  struct gpl_compliant_str *togpl,
		  struct desc_str *system_desc,
		  int proposed_row,
		  char **string2print)
  {
  ....
  }
asm ("__sizeof_linux_set_params = . - linux_set_params\n");

  But with my version of GCC-3.4 (one month old,
 gcc (GCC) 3.4 20030924 (experimental)) the asm is now inserted
 at the beginning of the file, before any function, maybe because
 I am using --function-section.

  I cannot add "volatile" to this asm because it is refused by
 the compiler on this context.

  I noticed the line:
.size   menu_load_system, .-menu_load_system
  after every function there is such a line.

  Is there any official way to get the value of this last
 debugging symbol - or an official way to get the size of a
 function?

  Thanks,
  Etienne.

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]