]> gcc.gnu.org Git - gcc.git/commit
Darwin: Update rules for handling alignment of globals.
authorIain Sandoe <iain@sandoe.co.uk>
Mon, 20 Dec 2021 15:19:50 +0000 (15:19 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Sun, 21 May 2023 18:54:04 +0000 (19:54 +0100)
commit9473ba97f087a080b41e2c5e29a695aa295a6b31
treeea3d78cedecb927566ee5301fece404f32b4b7e8
parentf625d13d2d7769db0913f505b9c545da96462203
Darwin: Update rules for handling alignment of globals.

The current rule was too strict and has not been required since Darwin11.

This relaxes the constraint to allow up to 2^28 alignment for non-common
entities.  Common is still restricted to a maximum aligment of 2^15.

When the host is an older version of Darwin ( earlier that 11 ) then the
existing constraint is still applied.  Note that this is a host constraint
not a target one (so that a compilation on 10.7 targeting 10.6 is allowed
to use a greater alignment than the tools on 10.6 support).  This matches
the behaviour of clang.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:

* config.gcc: Emit L2_MAX_OFILE_ALIGNMENT with suitable
values for the host.
* config/darwin.c (darwin_emit_common): Error for alignment
values > 32768.
* config/darwin.h (MAX_OFILE_ALIGNMENT): Rework to use the
configured L2_MAX_OFILE_ALIGNMENT.

gcc/testsuite/ChangeLog:

* gcc.dg/darwin-aligned-globals.c: New test.
* gcc.dg/darwin-comm-1.c: New test.
* gcc.dg/attr-aligned.c: Amend for new alignment values on
Darwin.
* gcc.target/i386/pr89261.c: Likewise.

(cherry picked from commit 19bf83a9a068f2d5293b63c9300f99172b2d278d)
gcc/config.gcc
gcc/config/darwin.c
gcc/config/darwin.h
gcc/testsuite/gcc.dg/attr-aligned.c
gcc/testsuite/gcc.dg/darwin-aligned-globals.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/darwin-comm-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr89261.c
This page took 0.082945 seconds and 6 git commands to generate.