weirdly large filesize of winegcc generated shared object

Pengyu CHEN cpy.prefers.you at gmail.com
Fri Feb 17 06:00:18 CST 2012


Hello everyone,

I'm new here, and if I did/said something wrong, please point out instead
of throwing stones at me :-)

I'm currently developing stuffs with winelibs, and when building a shared
lib with winegcc, I find the generated file is weirdly large.
The example below illustrates my problem.

// this is a.c
__attribute__((cdecl)) void *test()
{
    return 0;
}

// and this is a.spec
@ cdecl test()

Then I compiled them using 'winegcc a.c a.spec -shared -fPIC -m32', and
then found the resulting file a.out.so is about 70KB in size:
[pengyu at pengyu-Studio-1747 tmp]$ls a.out.so -l
-rwxr-xr-x 1 pengyu users 75893 Feb 17 19:16 a.out.so

By analyzing the file I found in a.out.so there is an extremely large
section .init with size of nearly 70KB. That's weird since a normal .init
section is quite small. Though I know wine would do its initialization
here, but 70KB is still too large I think.
And after disassembling and also viewing the file with hexadecimal viewer,
I found nearly all contents of .init section of a.out.so is filled with
zero bits.
Is this a bug or feature? Since .init section is read/execute only, I
didn't see any benefit from these filling zeros.
Can anybody make some explanations please? And, is there any methods to
remove these zeros in the generated shared object and get a smaller file?

Regards,
Pengyu

-- 
*
[A very large, very cold, and extremely isolated planet.]
[ApertureScience][Grow Old or Die Trying]
[ZJU/ComputerScience][Archer/Googler/kind of geek]
[C/Python/Mathematica/CommonLisp/Assembly]
[CpyPrefersYou/HjrJustifiablyReturns]
[AboutMe <http://about.me/cpy>]
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20120217/f6698cea/attachment.html>


More information about the wine-devel mailing list