LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-09-2006, 01:43 PM   #1
quartermaster
LQ Newbie
 
Registered: Aug 2006
Posts: 1

Rep: Reputation: 0
total size of segments reported by Readelf/Objdump 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.

(obviously, this is not HTML code, but I couldn't get it formatted right without doing this)

[HTML]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
...[/HTML]

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!
 
Old 08-11-2006, 01:31 PM   #2
pda_h4x0r
Member
 
Registered: Feb 2006
Location: somewhere in cyberspace
Distribution: Debian, Familiar
Posts: 380

Rep: Reputation: 30
Is it possible that your compiler added byte padding to your code and data segments (i.e. to make read/write operations faster)?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Drive size not reported correctly dlynch912 Linux - General 4 02-23-2006 05:04 AM
sum total of file sizes allelopath Linux - General 3 01-07-2006 08:30 AM
/proc/kcore size doesn't match with physical ram size cash_05 Linux - Newbie 2 06-01-2005 01:23 PM
making x.org virtual size match up with actual size tommyj27 Linux - Software 0 11-16-2004 06:53 PM
reported partition size error jsmarshall85 Debian 4 11-06-2004 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration