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@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