Question about section alignment

robert song robertsong.linux@gmail.com
Wed Feb 20 09:39:00 GMT 2008


Hello, everyone.
I found that in binutils-2.17.50/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 these sections  must be set to 16 byte boundaries,
when I changed
the alignment of data_section from 4 to 2 and the test file can also
be run on my
mips target. Could anyone explain it to me ?


Thank you very much.

robert



More information about the Binutils mailing list