Alignment of .rodata symbols wasting space

John Carter john.carter@tait.co.nz
Fri May 13 00:10:00 GMT 2005


I am linking an executable for an embedded target with very limited 
rom/ram resources.

While analysing our space requirements I noted a fairly large discrepancy 
between the amount of rodata reported by readelf vs adding up the 
individual symbols reported by objdump --syms. (About a factor 1.5)

As far as I can see, there are two sources for this discrepancy...
   1) Alignment. (1 byte symbol followed by a 4 byte aligned symbol)
   2) Some large mysterious other thing between the last symbol and the end
      of the rodata segment..

Question 1)
  Any ld flags / linking script options / ... that I can use to pack all
  byte aligned objects together?

Question 2)
  Any guesses as to what are the mystery rodata items that are not showing
  up in objdump --syms?

Question 3)
   Are these problems perhaps an artifact of the somewhat elderly version
   of the toolchain we are using? ie. Would upgrading solve this problem?
   sparc-rtems-gcc 2.95.2
   sparc-rtems-objdump 2.11


Thanks,


John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter@tait.co.nz
New Zealand




More information about the Gcc-help mailing list