Thursday, September 1, 2011

Size of the linux library

http://groups.google.com/group/gnu.gcc.help/browse_thread/thread/275b49bca43300be?pli=1

Hi Guys!

I have such library:

$ size -A lib.so.1  :
section              size       addr
.hash              172504        180
.dynsym            427408     172684
.dynstr            248347     600092
.gnu.version        53426     848440
.gnu.version_r        144     901868
.rel.dyn         19750456     902012
.rel.plt              336   20652468
.init                  23   20652804
.plt                  688   20652828
.text              135412   20653520
.fini                  28   20788932
.rodata           4215968   20788960
.eh_frame               4   25004928
.ctors                  8   25009028
.dtors                  8   25009036
.jcr                    4   25009044
.data.rel.ro     15683552   25009056
.dynamic              240   40692608
.got                  352   40692848
.got.plt              180   40693200
.data                 136   40693380
.bss                  108   40693536
.comment             5220          0
Total            40694552

I've noticed .rel.dyn section is pretty big (almost 20M).What is
the possible reason of that size and how to reduce it?

Wow! You must have a *lot* of external data and constants referenced
from that library.

> I've noticed .rel.dyn section is pretty big (almost 20M).What is
> the possible reason of that size and how to reduce it?
You can see what goes into rel.dyn with:
readelf -r lib.so.1
For .data.rel.ro, do this:
objdump -T  lib.so.1 | grep data.rel.ro

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


    Reply to author      Forward       






mkaszc...@gmail.com  
View profile  
 More options Sep 11 2008, 11:44 am
> You can see what goes into rel.dyn with:
> readelf -r lib.so.1
That's really interesting:
I have 2470084 entries like that:

013b572f  00000008 R_386_RELATIVE
013b5738  00000008 R_386_RELATIVE
013b574b  00000008 R_386_RELATIVE
013b5768  00000008 R_386_RELATIVE
013b5776  00000008 R_386_RELATIVE

I've googled that:
"The dummy R_386_RELATIVE relocations are used to adjust the required
absolute addresses at run time."

M.

    Reply to author      Forward       






Paul Pluzhnikov  
View profile  
 More options Sep 12 2008, 2:39 am
mkaszc...@gmail.com writes:
>> You can see what goes into rel.dyn with:
>> readelf -r lib.so.1
> That's really interesting:

> I have 2470084 entries like that:

> 013b572f  00000008 R_386_RELATIVE
> 013b5738  00000008 R_386_RELATIVE
> 013b574b  00000008 R_386_RELATIVE
> 013b5768  00000008 R_386_RELATIVE
> 013b5776  00000008 R_386_RELATIVE
You probably didn't look far enough into the list to find
"meaningful" entries. Try 'readelf -r lib.so.1 | grep 013b572f'
> I've googled that:
> "The dummy R_386_RELATIVE relocations are used to adjust the required
> absolute addresses at run time."
That was possibly written by someone clueless, or else you took
the statement out of context. There is nothing "dummy" about
R_386_RELATIVE relocations.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

No comments:

Post a Comment