08 Feb 2008 08:51:45 -0800, Ian Lance Taylor <iant@xxxxxxxxxx>: > "robert song" <robertsong.linux@xxxxxxxxx> writes: > > > 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'm just guessing, but it looks like an alignment issue. It looks > like the compiler is aligning h_errlist at a 16-byte boundary. That > is causing an extra 4 zero bytes to be inserted in the "without > -fdata-sections" case. > > Ian > lan, thank you very much for your reply. I found that in binutils/gas/config/tc-mips.c there are some codes as bellows: /* On a native system other than VxWorks, sections must be aligned to 16 byte boundaries. When configured for an embedded ELF target, we don't bother. */ if (strcmp (TARGET_OS, "elf") != 0 && strcmp (TARGET_OS, "vxworks") != 0) { (void) bfd_set_section_alignment (stdoutput, text_section, 4); (void) bfd_set_section_alignment (stdoutput, data_section, 4); (void) bfd_set_section_alignment (stdoutput, bss_section, 4); } I don't kow why the sections before must be set to 16 byte boundaries, but not 4 bytes? Will it cause problems in some target? Thank you very much. Robertsong