This is the mail archive of the binutils@sourceware.org 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]

readelf/objdump segment size doesn't match symbol table sizes


Hello,

I am sorry about the length of this post, but my problem takes a good bit of
explanation.

I am using msp430-readelf and msp430-objdump to get information about the
sizes of functions and global variables from the executable generated by
compiling a tinyOS application. But, I am having trouble reconciling the
segment sizes (.text, .bss, and .data) reported by readelf and objdump with
the sizes of the individual objects as reported by 'readelf -s'

For example, I have an executable called 'main.exe'. objdump and readelf
both report the following segment sizes:


.text   6060
.data        4
.bss     116 


when I have readelf display the symbol table entries with 'msp430-readelf -s
main.exe', I get something like this fragment below. A '1' in the 'Ndx'
column indicates that this belongs to the .text section while '2' and '6'
indicate .data and .bss sections, respectively. 

Symbol table '.symtab' contains 336 entries:
 Num:   Value        Size Type         Bind         Vis         Ndx  Name
...
  255: 00004e3e     76 FUNC        LOCAL     DEFAULT    1  
SenseTaskM$processData
  256: 00001104       2 OBJECT     LOCAL     DEFAULT    6   i.0
  257: 00001102       2 OBJECT     LOCAL     DEFAULT    2   sum.1
  258: 00001106       2 OBJECT     LOCAL     DEFAULT    6   sum.2
  259: 0000547e   182 FUNC       LOCAL     DEFAULT    1   SenseTaskM$display
  260: 00004e8a     14 FUNC       LOCAL     DEFAULT    1  
InternalTempM$MSP430ADC12Multiple..
  261: 0000556a   272 FUNC       LOCAL     DEFAULT    1  
ADCM$triggerConversion
  262: 00005778     24 FUNC       LOCAL     DEFAULT    1  
RefVoltM$switchOffDelay
  263: 00005790     24 FUNC       LOCAL     DEFAULT    1  
RefVoltM$switchOffRetry
  264: 00000000       0 FILE         LOCAL     DEFAULT   ABS 
/home/showard/research/tos/....
  265: 00001108       1 OBJECT     GLOBAL    DEFAULT    6   SenseTaskM$head
  266: 0000110a       2 OBJECT     GLOBAL    DEFAULT    6  
MSP430DCOCalibM$m_prev
  267: 0000110c     24 OBJECT     GLOBAL    DEFAULT    6   TimerM$m_timers
...

When I sum the numbers in the 'size' column that also have a '1' in the
'Ndx' column, I get 5960 instead of 6060. Also, when I sum the 'size' column
figures that have a '2' in the 'Ndx' column, I get 3 instead of 4, and for
the 'Ndx' column value of '6', I get 112 instead of 116.

I have generated these sums automatically using a simple program I wrote
and, to verify the values, I summed them by hand. In both cases, I got the
same values. This seems to say that there is "stuff" in these sections that
contribute to the size which is not in the symbol table. But, I can't find
any information about this anywhere. However, for some applications, some of
the values match.

Does anybody have any idea why these figures don't match???

I don't think that the fact that I am working with tinyOS and nesC is
important, but I mention it just in case. 

Thanks for any help that can be provided!
-- 
View this message in context: http://www.nabble.com/readelf-objdump-segment-size-doesn%27t-match-symbol-table-sizes-tf2086556.html#a5750717
Sent from the Sourceware - binutils list forum at Nabble.com.


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