Problem about mips .data section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, everyone.
I have met a problem when I used mips gcc to compile a simple test file.

The file defines two variables as bellow.
const char *h_errlist[] = {
        "Resolver Error 0 (no error)",
        "Unknown host",                         /* 1 HOST_NOT_FOUND */
        "Host name lookup failure",             /* 2 TRY_AGAIN */
        "Unknown server error",                 /* 3 NO_RECOVERY */
        "No address associated with name",      /* 4 NO_ADDRESS */
};
int     h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };

I found that with the -fdata-sections option, the size of the data section
in the library genereated by the file has changed. The results are as bellow.

without -fdata-sections:

00010d20 <h_nerr>:
   10d20:       00000005 00000000 00000000 00000000     ................

00010d30 <h_errlist>:
   10d30:       00000c24 00000c40 00000c50 00000c6c     ...$...@...P...l
   10d40:       00000c84 00000000 00000000 00000000     ................

with -fdata-sections:

00010d30 <h_errlist>:
   10d30:       00000c30 00000c4c 00000c5c 00000c78     ...0...L...\...x
   10d40:       00000c90                                ....

00010d44 <h_nerr>:
   10d44:       00000005 00000000 00000000              ............

I tested it with the compilers of other architectures, and found that
they all keep the same size.

I have totally no idea how the mips gcc compiler acts with the .data section.


BTW, my gcc version : 4.1.1
     binutils version:2.17.50
     glibc:2.5

Thank you for your help!


Best Regards,
robert

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux