aboutsummaryrefslogtreecommitdiff
path: root/gcc/config.gcc
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2021-12-20 15:19:50 +0000
committerIain Sandoe <iain@sandoe.co.uk>2021-12-24 10:47:05 +0000
commit19bf83a9a068f2d5293b63c9300f99172b2d278d (patch)
tree2413e5caabb730ef387a3dcbe758fff1ba0a35fb /gcc/config.gcc
parent8381075ff3f5f5aefcd7027d7c5136a0e61e654a (diff)
downloadgcc-19bf83a9a068f2d5293b63c9300f99172b2d278d.zip
gcc-19bf83a9a068f2d5293b63c9300f99172b2d278d.tar.gz
gcc-19bf83a9a068f2d5293b63c9300f99172b2d278d.tar.bz2
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.
Diffstat (limited to 'gcc/config.gcc')
-rw-r--r--gcc/config.gcc14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index bf1c745..294f312 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -677,6 +677,20 @@ case ${target} in
macos_min=0
fi
def_ld64=85.2
+ # Tools hosted on earlier versions of Darwin constrained all object
+ # alignment to be 2^15 or smaller. From Darwin11 (macOS 10.7) the
+ # alignment of non-common is allowed to be up to 2^28. Note that the
+ # larger alignment is permitted when targeting 10.6 from 10.7 so that
+ # the constraint only need be applied per host (and only if the host
+ # is Darwin).
+ case ${host} in
+ *-*-darwin[4-9]* | *-*-darwin10*)
+ tm_defines="$tm_defines L2_MAX_OFILE_ALIGNMENT=15U"
+ ;;
+ *)
+ tm_defines="$tm_defines L2_MAX_OFILE_ALIGNMENT=28U"
+ ;;
+ esac
case ${target} in
# Darwin 4 to 19 correspond to macOS 10.0 to 10.15
*-*-darwin[4-9]* | *-*-darwin1[0-9]*)