From patchwork Thu Nov 15 03:02:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 998059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-490139-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="SvTfxZ8Z"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42wR3y1zn3z9s5c for ; Thu, 15 Nov 2018 14:02:21 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=O5gmfRqwmXFCpznQCObx8ilHu8yvURpNmAWxw0JgScsf7MT+gP xHV57kCYXbuBUjJCRn0IVc5MmhSnHP+Fl8GnuEQCEHrnEYUPwuNduwL/i7JBqTTj aoU8IguIUuKEyEsjObnlwJjAoTQwgXnVTLnYgsVRKjHFp0FXy1h0nYN8o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=h9fD3e+2G/iUU+xl0qmzeEExO8Y=; b=SvTfxZ8ZhngWBK+C7oS+ ImOdCxpmNMJbP4os8ma5HgFe395a8maJ3Rxyv+6C93xrZykr6ebR/xtnYeugB6sP UWY47W2E1adchTQ1v6iUhlU2k72W5aavtNqe/uO6t+EOytj6IKT5XYDejaQIFeq/ JDBHAKmPqNDoYmZesKd+4nI= Received: (qmail 42741 invoked by alias); 15 Nov 2018 03:02:13 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 41825 invoked by uid 89); 15 Nov 2018 03:02:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=effectiveness, H*r:0800 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 15 Nov 2018 03:02:10 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gN7ux-0001u2-Rd from Sandra_Loosemore@mentor.com for gcc-patches@gcc.gnu.org; Wed, 14 Nov 2018 19:02:07 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Wed, 14 Nov 2018 19:02:05 -0800 To: "gcc-patches@gcc.gnu.org" From: Sandra Loosemore Subject: [doc, committed] __attribute__((aligned)) linker restrictions Message-ID: Date: Wed, 14 Nov 2018 20:02:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 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 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}.)