simplest way to get the size of an output section

Etienne Lorrain etienne_lorrain@yahoo.fr
Mon Oct 4 09:51:00 GMT 2004


  Hello,

  On a Linux ia32 system, I am trying to get the size of an output
 section of an ELF file to use it automatically in a Makefile.

 Ideally I would like to compile a small GCC program like:
gcc -Wl,--defsym,linker_tells_size=SIZEOF(.text16) print_command_line.c
 but that will not work because --defsym cannot get the SIZEOF().

 So I have gone the objcopy way:
objcopy --output-target binary --only-section .text16 vmlinux param.bin
./print_command_line ` cat param.bin | wc -c `
 That does the job, but is there a way to not create the temporary file
 "param.bin" (i.e. objcopy uses standard output) (because it is always
 a problem in Makefiles: it may already exist and be write protected,
 it needs to be cleaned by make clean, an interrupted make command
 may leave the temporary file...) or another way, without using too
 complex awk or sed scripts?

  Thank you,
  Etienne.


	

	
		
Vous manquez dÂ’espace pour stocker vos mails ? 
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com



More information about the Binutils mailing list