I've checked in this patch for PR 56334, following the recommendation in
comment 1 in that issue to
* distinguish between stack-allocated and statically-allocated variables
* mention object file format restrictions and not just blame it on the
linker.
-Sandra
2018-11-15 Sandra Loosemore <san...@codesourcery.com>
PR other/56334
gcc/
* doc/extend.texi (Common Function Attributes): Clarify linker
restrictions on "aligned" attribute.
(Common Variable Attributes): Likewise. Mention that linker
restrictions don't apply to stack-allocated variables.
Index: gcc/doc/extend.texi
===================================================================
--- gcc/doc/extend.texi (revision 266169)
+++ gcc/doc/extend.texi (working copy)
@@ -2396,7 +2396,8 @@ alignment this overrides the effect of t
function.
Note that the effectiveness of @code{aligned} attributes may be
-limited by inherent limitations in your linker. On many systems, the
+limited by inherent limitations in the system linker
+and/or object file format. On some systems, the
linker is only able to arrange for functions to be aligned up to a
certain maximum alignment. (For some linkers, the maximum supported
alignment may be very very small.) See your linker documentation for
@@ -6132,8 +6133,9 @@ attribute must be specified as well. Wh
@code{aligned} attribute can both increase and decrease alignment, and
specifying the @code{packed} attribute generates a warning.
-Note that the effectiveness of @code{aligned} attributes may be limited
-by inherent limitations in your linker. On many systems, the linker is
+Note that the effectiveness of @code{aligned} attributes for static
+variables may be limited by inherent limitations in the system linker
+and/or object file format. On some systems, the linker is
only able to arrange for variables to be aligned up to a certain maximum
alignment. (For some linkers, the maximum supported alignment may
be very very small.) If your linker is only able to align variables
@@ -6141,6 +6143,9 @@ up to a maximum of 8-byte alignment, the
in an @code{__attribute__} still only provides you with 8-byte
alignment. See your linker documentation for further information.
+Stack variables are not affected by linker restrictions; GCC can properly
+align them on any target.
+
The @code{aligned} attribute can also be used for functions
(@pxref{Common Function Attributes}.)