aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteve Ellcey <sje@cup.hp.com>2009-03-03 18:27:42 +0000
committerSteve Ellcey <sje@gcc.gnu.org>2009-03-03 18:27:42 +0000
commit8b9d598f0340b46fb087c0a7009ee982cb9475f8 (patch)
tree32d3695bd577871d9fe04bdf8dc6493d06b3f8b1 /gcc
parent13e4e36e171c7053eb63e848b841b8154eaada40 (diff)
downloadgcc-8b9d598f0340b46fb087c0a7009ee982cb9475f8.zip
gcc-8b9d598f0340b46fb087c0a7009ee982cb9475f8.tar.gz
gcc-8b9d598f0340b46fb087c0a7009ee982cb9475f8.tar.bz2
re PR middle-end/34443 (The GCC manual about section variable attribute is incorrect)
PR middle-end/34443 * doc/extend.texi (section): Update description. From-SVN: r144582
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/doc/extend.texi21
2 files changed, 16 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3d4b017..a4a1874 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2009-03-03 Steve Ellcey <sje@cup.hp.com>
+
+ PR middle-end/34443
+ * doc/extend.texi (section): Update description.
+
2009-03-03 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/39345
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 21769c1..f901db3 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3872,7 +3872,7 @@ section. For example, this small program uses several specific section names:
struct duart a __attribute__ ((section ("DUART_A"))) = @{ 0 @};
struct duart b __attribute__ ((section ("DUART_B"))) = @{ 0 @};
char stack[10000] __attribute__ ((section ("STACK"))) = @{ 0 @};
-int init_data __attribute__ ((section ("INITDATA"))) = 0;
+int init_data __attribute__ ((section ("INITDATA")));
main()
@{
@@ -3889,18 +3889,19 @@ main()
@end smallexample
@noindent
-Use the @code{section} attribute with an @emph{initialized} definition
-of a @emph{global} variable, as shown in the example. GCC issues
-a warning and otherwise ignores the @code{section} attribute in
-uninitialized variable declarations.
+Use the @code{section} attribute with
+@emph{global} variables and not @emph{local} variables,
+as shown in the example.
-You may only use the @code{section} attribute with a fully initialized
-global definition because of the way linkers work. The linker requires
+You may use the @code{section} attribute with initialized or
+uninitialized global variables but the linker requires
each object be defined once, with the exception that uninitialized
variables tentatively go in the @code{common} (or @code{bss}) section
-and can be multiply ``defined''. You can force a variable to be
-initialized with the @option{-fno-common} flag or the @code{nocommon}
-attribute.
+and can be multiply ``defined''. Using the @code{section} attribute
+will change what section the variable goes into and may cause the
+linker to issue an error if an uninitialized variable has multiple
+definitions. You can force a variable to be initialized with the
+@option{-fno-common} flag or the @code{nocommon} attribute.
Some file formats do not support arbitrary sections so the @code{section}
attribute is not available on all platforms.