------- Comment #14 from thutt at vmware dot com  2007-03-26 18:54 -------
> Why do you think sections are special?
> GCC does not know if a section is special or not and it really should not 
> know.

I don't necessarily think that sections are 'special', but since gcc
has the capability to change the section, it seems like it ought to
follow instructions.

If that's not convincing enough, let me quote from the gcc 'info' page
about function attributes:

     `section ("SECTION-NAME")'

          Normally, the compiler places the code it generates in the
          `text' section.  Sometimes, however, you need additional
          sections, or you need certain particular functions to appear
          in special sections.  The `section' attribute specifies that
          a function lives in a particular section.  For example, the
          declaration:

               extern void foobar (void) __attribute__ ((section ("bar")));

          puts the function `foobar' in the `bar' section.

          Some file formats do not support arbitrary sections so the
          `section' attribute is not available on all platforms.  If
          you need to map the entire contents of a module to a
          particular section, consider using the facilities of the
          linker instead.

I don't think that I can be more clear than this text -- placing an
__attribute__(section ("bar")) will place the attributed function into
the 'bar' section.

By inlining the function, it's *not* placing it into the 'bar'
section.

There are many reasons why a function might need to be placed into a
special section but those reasons are really moot since the
documentation of the compiler states exactly what the section attribute
is supposed to do.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31362

Reply via email to