From d8fdf280ab8e6f12746f23717cc0cf92871561d1 Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Wed, 14 Nov 2018 21:55:26 -0500 Subject: [PATCH] re PR other/56334 (__attribute__((aligned)) documentation is misleading) 2018-11-15 Sandra Loosemore 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. From-SVN: r266170 --- gcc/ChangeLog | 8 ++++++++ gcc/doc/extend.texi | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3b42488c3ac..143a4398336 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-11-15 Sandra Loosemore + + PR other/56334 + * 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. + 2018-11-15 Joern Rennecke * gensupport.c (add_predicate_code): Properly handle ZERO_EXTRACT diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 15d973a7f48..d4b1046b6ae 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2396,7 +2396,8 @@ alignment this overrides the effect of the 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. When used as part of a typedef, the @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, then specifying @code{aligned(16)} 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}.) -- 2.30.2