This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: position of section() attribute question
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: DJ Delorie <dj at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 10 Jun 2005 01:43:23 +0000 (UTC)
- Subject: Re: position of section() attribute question
- References: <200506100113.j5A1DjHf008324@greed.delorie.com>
On Thu, 9 Jun 2005, DJ Delorie wrote:
>
> Consider:
>
> int __attribute__((section("foo"))) *var1;
> int * __attribute__((section("foo"))) var2;
>
> var2 is itself in section foo, and points to an int.
>
> Isn't var1 a pointer to something in section foo, and not itself in
> foo? GCC instead treats var1 like var2.
>
> I couldn't figure out a suitable search string to see if this has been
> discussed before, please feel free to just point me at an old email
> somewhere.
The interpretation of attribute specifiers is explained in "Attribute
Syntax" in the manual. If the attribute specifier is part of the
declaration specifiers, it applies to the declaration; see vector_size for
how to write handlers for attributes which should apply to the type given
in the declaration specifiers instead. "section" attributes are presently
storage-class-like (similar to "static") and only work on declarations.
If you want something like section attributes but affecting types then
TR18037 (or perhaps the updated version in WG14 N1120) named address
spaces would indicate the appropriate semantics.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)