function-sections and data-sections option in gcc

Discussion in 'C Programming' started by Raman, Aug 2, 2007.

  1. Raman

    Raman Guest

    Hi All,


    Could any one tell what exactly these two option do. I have not been
    able to understand why we use them because as per the gcc man page,
    these options increase the size of libraries and exe


    Thanks in advance,
    Raman Chalotra
     
    Raman, Aug 2, 2007
    #1
    1. Advertisements

  2. Raman

    Spoon Guest

    This group is not appropriate to answer your question.
    cf. http://gcc.gnu.org/lists.html

    http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Optimize-Options.html

    -ffunction-sections
    -fdata-sections
    Place each function or data item into its own section in the output
    file if the target supports arbitrary sections. The name of the function
    or the name of the data item determines the section's name in the output
    file.

    Use these options on systems where the linker can perform
    optimizations to improve locality of reference in the instruction space.
    Most systems using the ELF object format and SPARC processors running
    Solaris 2 have linkers with such optimizations. AIX may have these
    optimizations in the future.

    Only use these options when there are significant benefits from
    doing so. When you specify these options, the assembler and linker will
    create larger object and executable files and will also be slower. You
    will not be able to use gprof on all systems if you specify this option
    and you may have problems with debugging if you specify both this option
    and -g.
     
    Spoon, Aug 2, 2007
    #2
    1. Advertisements

  3. Raman

    Flash Gordon Guest

    Raman wrote, On 02/08/07 08:49:
    This is to do with gcc, not the C programming language, so you need to
    ask somewhere that deals specifically with gcc such as gnu.gcc.help
     
    Flash Gordon, Aug 2, 2007
    #3
  4. Raman said:
    Yes. The people in gnu.gcc.help could.
     
    Richard Heathfield, Aug 2, 2007
    #4
  5. What two options?

    Oh, I see, it's in the subject header. Please put the entire question
    in the body of your message.

    As it happens, your question really isn't about C. I believe the gcc
    documentation answers your question. If not, try gnu.gcc.help.
     
    Keith Thompson, Aug 2, 2007
    #5
  6. Raman

    Raman Guest


    My apologise for putting option in subject.

    Thanks for the responce.

    Regards,
    Raman Chalotra
     
    Raman, Aug 3, 2007
    #6
  7. Raman

    santosh Guest

    Also please don't quote signature blocks, i.e., text after a '-- NL'
    sequence, unless you're discussing it, which is almost always off-topic.
     
    santosh, Aug 3, 2007
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.